开发者

How can I POST Unicode data with QNetworkAcccessManager

开发者 https://www.devze.com 2023-02-14 16:19 出处:网络
I filled a QString object with Unicode data and tried to send it with QNetworkAcccessManager.post method and in server I received some ?????? instead of Unicode characters but the JSON format was vali

I filled a QString object with Unicode data and tried to send it with QNetworkAcccessManager.post method and in server I received some ?????? instead of Unicode characters but the JSON format was valid on server (I send data in this format). Then I used QString.toUtf8 method before send开发者_如何学Pythoning and there was some strange characters (maybe correct ones) on server but JSON format was not valid, it means JSON decoder function of Rails framework didn't parse it. Can you help me?


Converting your string to QByteArray using toUtf8() and then using post is working here.

For me, it's rather a server issue than a client one. To prove it, you can:

  • Try to generate the request using another framework (e.g. python)
  • use wireshark to dump network communication

Moreover, you should state which version of Qt you're using, it might help reproduce.

0

精彩评论

暂无评论...
验证码 换一张
取 消