Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
4.8.0, 4.8.2, 5.3.0 Beta1
-
None
-
Windows 7, mingw (problem also seen with MSVC2005)
Description
Non-ASCII Latin-1 characters are not handled properly by the qsTr() function.
The attached example program shows that the correct translation ('good') is chosen by the C++ translate() function, whereas another translation ('bad') is chosen by the qsTr() function, regardless of where the string to translate comes from. With Qt 4.7.4 the correct translation ('good') is chosen by both translate() and qsTr().
The translation string chosen by qsTr() was (erroneously) added to the .ts file by lupdate, and seems to be the result of a UTF-8 character sequence treated as Latin-1 and yet again transformed to UTF-8 (or something along those lines).
To reproduce the problem, simple compile and run the example code and see that different translations ('good'/'bad') are chosen.
The codecs for the source code files are the default ones, i.e. Latin-1 for the C++ files and UTF-8 for the QML file.