Hallo,

how to read in and display national characters in a Java GUI program?

Configuration: Linux RH 6.1, KDE with Polish locales + JDK117_v3. There are
2 main char encodings in Poland: Cp1250 (Win32) and iso8859_2 (Unix). I have
following 3 files, containing PL national characters:

pol.iso8859_2 (8859_2 encoding)
pol.cp1250 (Cp1250 encoding)
pol.unicode (Unicode encoding)

I have also a GUI program, which reads a file using InputStreamReader with
a particular encoding (this can be set thru a Choice object). Next a string
is constructed and displayed in TextArea. The sequence looks like:

File --> char[] --> String --> GUI

Now, what I would expect is, when I load eg. pol.iso8859_2 using 8859_2
encoding I should see proper PL characters. One could draw the following
table:

File/Encoding      8859_2  Cp1250  Unicode
pol.iso8859_2        ok
pol.cp1250                   ok
pol.unicode                           ok

This does work on WinNT, unfortunately it does not work on Linux. The only
combination which works is: pol.iso8859_2 with 8859_1 encoding (!?). 8859_1
is also the default encoding on Linux (!?), although LANG is set to pl_PL.

Now, my questions are:

1. Why 8859_1 is the default encoding?
2. Why the table above "does not work" on Linux?
3. Why does pol.iso8859_2 "work" with 8859_1?
4. It is very interesting to know what happens during the last step:
   String --> GUI. I suppose String is converted to the default encoding,
   but I am not sure.

If you wish I can post a simple program and pol.* files to demonstrate
the problem.

Thanks and best regards
Marek Gmyrek.


----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to