Qt World Summit: Register Today!

QTextCodec::codecForLocale does not work in N950 for codec GB2312 encoding text

  • I was using QTextCodec::codecForLocale to detect the suitable codec to decode some plain text, but I found when I set the local to China and had a text file which was encoded with GB2312 the QTextCodec::codecForLocale() did not return the right codec.

    The returned was "System", I checked the doc, it said "On Windows, the codec will be based on a system locale. On Unix systems, starting with Qt 4.2, the codec will be using the iconv library. Note that in both cases the codec's name will be "System".".

    But when I used the codec to decode some text, the same code worked well on windows, but on N950 the decoded string only contained English and number characters.
    Does anyone know why?

Log in to reply