Does QString::fromUtf8 automatically reverse a Hebrew string?
I am h开发者_Go百科aving a problem where a Hebrew string is being displayed in reverse. I use QTableWidget to display some info, and here the string appears correctly using:
CString hebrewStr; hebrewStr.ToUTF8();
QString s = QString::fromUtf8( hebrewStr );
In another part of my program this same string is displayed on the screen, but not using QT, and this is what is being shown in reverse:
CString hebrewStr;
hebrewStr.ToUTF8();
I have debugged and hebrewStr.ToUTF8() in both cases produces the exact same unicode string, but the string is only displayed correctly in the QTableWidget. So I am wondering if Qt automatically reverses a given Hebrew string (since it is a rigth-to-left language). Thanks!
Yes, in this case QString
generate the full unicode wchar_t
from the UTF-8 encoded string. If you would like to do similar thing in MFC, you should use CStringW
and decode the string.
Use MultiByteToWideChar
for UTF8 to CStringW conversion.
Connected question in StackOverflow.
精彩评论