0

A Qt object bases on Qt4 and runs on CentOS 7.

I get a QString file directory from getExistingDirectory. File name contains Chinese characters. Then I use toLocal8Bit to convert it to char, and the char variable occurs messy code.

I tried QTextCodec with GBK, big5 and so on, there is no progress.

Michał Ciuba
  • 7,876
  • 2
  • 33
  • 59
cyberpunker
  • 49
  • 1
  • 1
  • 7
  • Wonder how this would work... there are thousands upon thousands of characters in Chinese, and an 8bit char can only hold as much as 256 and some of them are reserved... – dtech Nov 28 '14 at 12:17

1 Answers1

0

toLocal8bit on CentOS likely doesn't support unicode, instead use toUtf8 which is the ascii compatible unicode encoding.

However whatever will interpret the char* will need to know it is in UTF8 otherwise you will still see garbage on the receiving end.

ratchet freak
  • 47,288
  • 5
  • 68
  • 106