QsTr() and non-ASCII characters



  • Has anyone successfully used qsTr() with a source string containing non-ASCII Latin-1 characters? I just cannot make it work.
    Especially not with Qt 4.8.2. Using 4.7.4 it seems to work on the target Windows CE device, but not on Windows. Using 4.8.2, there seems to be an additional conversion to UTF-8, which makes the string get an extra Â. This means no translation is found, because the translation file does not contain the extra Â, and the string returned by qsTr() is the string with the extra Â.



  • Hi,

    There was a known issue with this in 4.7, but it should be working in 4.8 (see https://bugreports.qt-project.org/browse/QTBUG-14989 for details). I'd suggest opening a new bug if this isn't working correctly in 4.8.2.

    Regards,
    Michael



  • The bug report deals with non-Latin-1 characters, my problem is with Latin-1 characters.
    I made a simple example which works as expected on Windows with 4.7.4, but does not work with 4.8.2 (or 4.8.0). I will file a bug report for this.



  • Hi,

    Oops, sorry for the confusion. One other thing you could check is the encoding of the QML file, as the QML engine expects all files to be UTF-8 encoded.

    Regards,
    Michael



  • QML file is UTF-8, C++ files are Latin-1.
    Filed a bug report for this as "QTBUG-26193":https://bugreports.qt-project.org/browse/QTBUG-26193.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.