Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.6.0
-
None
-
13
-
Qt6_Foundation_Sprint 17
Description
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.
Attachments
For Gerrit Dashboard: QTBUG-54942 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
313211,6 | Use UTF-8 when converting 8 bit data in QTextStream | dev | qt/qtbase | Status: MERGED | +2 | 0 |