-
Type:
Bug
-
Status: Closed
-
Priority:
P2: Important
-
Resolution: Done
-
Affects Version/s: 5.6.0
-
Fix Version/s: 6.0
-
Component/s: Core: I/O, Core: QString and Unicode
-
Labels:None
-
Story Points:13
-
Sprint:Qt6_Foundation_Sprint 17
With the beginning of Qt5 string literals are assumed to be utf8 encoded (see the QString constructor from const char *). So I have converted my sourcecode to utf8.
But yet I get the wrong output if I print a string literal onto a QTextStream. The QTextStream output operator interprets const char * always as ISO-8859-1 encoded (see documentation). This is inconsistent. I have to encode string literals as utf8 if I use them to initialize a QString and as latin1 if I use them for output.
I also cannot change the output-operator of QTextStream because it is not virtual. The only solution is to convert every string explicitly into a QString via QString::fromUtf8. (I have to do this for thousends of strings).
Please use the same encoding for string literals in QString and QTextStream or add a method to change the default for QTextStream.