How can I POST Unicode data with QNetworkAcccessManager

327 Views Asked by At

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 sending 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?

1

There are 1 best solutions below

0
On BEST ANSWER

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.