-
Notifications
You must be signed in to change notification settings - Fork 378
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
乱码 #97
Comments
我这周看一下这个问题,可能是最近的某个pr引入的问题。 |
你的server 代码是什么样的?我测试example里面的test_sub1 看到订阅的数据是正常的。 // client
void test_sub1() {
rpc_client client;
client.enable_auto_reconnect();
client.enable_auto_heartbeat();
bool r = client.connect("127.0.0.1", 9000);
if (!r) {
return;
}
client.subscribe("key", [](string_view data) {
std::cout << data << "\n";
});
std::string str;
std::cin>>str;
} |
这里发不了压缩包吗?想要把测试程序源码发过去给你看看 |
全部相关代码如下 class CMFCApplication2Dlg : public CDialogEx .cpp CMFCApplication2Dlg::CMFCApplication2Dlg(CWnd* pParent /=nullptr/) { BOOL CMFCApplication2Dlg::OnInitDialog()
} void CMFCApplication2Dlg::OnBnClickedOk()
} |
subscribe 得到的数据需要解包一下: client.subscribe("key", [](string_view data) {
std::cout << data << "\n";
}); 改成 client.subscribe("key", [](string_view data) {
msgpack_codec codec;
auto str = codec.unpack<std::string>(data.data(), data.size());
std::cout << str << "\n";
}); 这样就没有乱码了,略有不便,后面我改一下,改成让框架自动去解包。 |
按你的指引,成功解决了问题,谢啦 |
我在win11 x64上写了个测试,发现subscribe响应时传过来的首字变成乱码,后面的正常,??
而编译运行你们自带的example没有这个问题,unicode、非unicode、MSGPACK_NO_BOOST、console、mfc这些组合我都试了,都一样的问题
期待能得到回复,先谢了
注:
vs2022
使用的是c++14
rest_rpc是3-28-23从github下载回来的
我是在同一个exe中开启的server及client
The text was updated successfully, but these errors were encountered: