On Mon, 7 Apr 2008, Eskil Abrahamsen Blomfeldt wrote:

> 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?
>
No.

I've just one problem.
QTextCodec.codecForLocale() returns "System", which is... annoying, 
because when I run an application (having utf-8 as my base encoding),
which reads iso2 files into string, converts this string to unicode,
and then (from unicode) to target encoding (which is the base encoding of
the wmsystem, in my case KDE & utf-8) the string are displayed incorrectly
in gui objects like QLineEdit.

Please, note that in this example utf8->utf8 conversion is not needed
and stupid, but the target encoding is unpredictable and someone could
have i.e.: iso1 as his target encoding.

When, before launching the application, you set LANG env. variable
it works properly; but I don't want to force my app's users to
setting such variables (and I don't know how it behaves on Windows).


--
Tomasz 'Trog' Welman
_______________________________________________
Qt-jambi-interest mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-jambi-interest

Reply via email to