[Qt-interest] Non-latin characters in QString and char * on Windows
Konstantin Tokarev
annulen at yandex.ru
Wed Mar 2 21:05:25 CET 2011
Hi all,
I need to convert QString, containg non-latin characters (specifically, cyrillic) to const char *,
in order to open file with ifstream (requirement of 3rd party library). One may think that it's
about QString::toLocal8Bit(), but it does not help on Windows!
See attached program. On Linux with UTF-8 everything works fine with either toUtf8 or
toLocal8Bit. On Windows (default encoding is CP1251) both functions return crap (different
between each other). Of course, ifstream cannot open corrupted file paths.
How to get proper representation of QString fileName in const char * ?
--
Regards,
Konstantin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.cpp
Type: text/x-c++src
Size: 530 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110302/017fb21a/attachment.bin
More information about the Qt-interest-old
mailing list