PDA

View Full Version : Problem with Vietnamese Characters



dushyant1000
29th October 2014, 09:59
Hi All,

I have QFile with name having Vietnamese Characters "Cộng hòa xã hội.rar".
To pass file name to libcurl I need filename in const char* format.
Below is the code to do the same:

QFile f("Cộng hòa xã hội.rar"); // I am hardcoding filename for example only, in my app I get this name from QDir::entryList()
qDebug(f.fileName ().toLocal8Bit().constData());

This code outputs correct in my PC where Language is English however same code doesn't work for the Window 7 PC where language is "Vietnamese".
Output there is some junk characters.

Is something wrong with my code ?

ChrisW67
29th October 2014, 19:30
This is likely to be a difference between the encoding used on the build machine to turn your string literal into bytes and the encoding used on the target machine and its file system. Without more information on those it is hard to say.