[Qt-jambi-interest] codecForTr
Tomasz 'Trog' Welman
twelman at swmud.pl
Mon Apr 7 22:17:40 CEST 2008
On Mon, 7 Apr 2008, Eskil Abrahamsen Blomfeldt wrote:
> Hi, Tomasz.
>
> In your case I would read the 8-bit encoded files into e.g. a QByteArray to
> avoid the implicit conversion to unicode, convert the byte array to unicode
> using QTextCodec and then setting this string directly on the QLineEdit.
> Since Qt Jambi handles all the GUI in your application, including the text,
> and Qt Jambi is inherently unicode-based, you should not need to worry about
> the 8-bit encoding of your target platform in the GUI elements.
>
I've written it exactly the same as you and... it works fine now. :-)
Thank You!
In my code I was doing this way:
1. read the file from BufferedReader to char array
2. append char array (portions) to StringBuffer
3. StringBuffer -> java.lang.String
4. String -> QTextCodec (setup to iso2!) toUnicode -> String
5. String -> formUnicode QTextCodec (setup to QTextCodec.codecForLocale) -> String
6. (my non encoding related operations on string)
7. String -> gui objects
I thing that step 3, or even 2 was causing this crap, because
of implicit encoding into unicode and then decoding it with
QTextCodec setup to iso2.
--
Tomasz 'Trog' Welman
More information about the Qt-jambi-interest
mailing list