[Qt-jambi-interest] codecForTr

Eskil Abrahamsen Blomfeldt eblomfel at trolltech.com
Mon Apr 7 08:34:08 CEST 2008


Hi, Tomasz.

Tomasz 'Trog' Welman wrote:
> What is the explanation for the absence of codecForTr/setCodecForTr
> in Qt Jambi?
>   

I believe this is because tr() is used with strings (so that they can be 
automatically detected as translatable) and Java strings are always 
encoded in 16-bit unicode. Internally this is solved by converting the 
Java string to UTF-8 and using the UTF-8 codec by default.

In C++ the tr() function takes a string of 8-bit characters, which can 
have different encodings, which is why the setCodecForTr() is more 
relevant there.

Do you have a use case where this reasoning is flawed?

-- Eskil


More information about the Qt-jambi-interest mailing list