PDA

View Full Version : International characters not displayed



joakimk
06-06-2007, 07:45 AM
I am working on a Java project (in NetBeans 5.5) under Linux (Fedora). When I enter some text into a JTextPane, the characters are displayed correctly -- including international chartacters like 'æ', 'ø', and 'å'.

The program is to be run on Knoppix, with the configurations (and home dir) stored on an USB disk. First off, in the terminal prompt, I am able to type accented characters, so it seems the System is configured correctly (under Keyboard, or whatever...). Also, the Java program writing to the pane works fine:

msgField.setText("æøå test"); // this is displayed correctly

However, when I type from the keyboard into the Java program, all accented characters (including ä, ö, ñ, é, etc) are displayed as boxes. And if I echo the contents of the pane to terminal, I simply get question marks:

System.out.println(msgField.getText()); // this is displayed as "??? test"
(Allso the correctly displayed characters (via setText, as above) are echoed as question marks...)

Does anyone have any tips on how to fix this? I have tried installing MSTT core fonts (http://penguinfonts.com/howto/knoppix.php#3) (from Windows) on the Knoppix USB disk... Any help greatly appreciated!
Also, I have looked through the Forum, found a few related topics, (http://www.knoppix.net/forum/viewtopic.php?t=26905) but no solutions (http://www.knoppix.net/forum/viewtopic.php?t=4380) that worked for me. I tried editing the /etc/sysconfig/i18n file and exporting the $LANG variable, too. Btw, here's my i18n file:

LANG="no_NO@euro"
COUNTRY="no"
LANGUAGE="no"
CHARSET="iso8859-1"
XMODIFIERS=""
and the command env outputs (among lots of other stuff) this:

SHELL=/bin/bash
TERM=xterm
LC_ALL=no_NO@euro
JAVA_HOME=/home/knoppix/bin/jdk1.5.0_09
LANGUAGE=no
BASH_ENV=/home/knoppix/.bashrc
JDKHOME=/home/knoppix/bin/jdk1.5.0_09


- Joakim
Norway

SiKing
06-06-2007, 09:17 AM
I have had problems with this as well. Not sure if this is going to help you, but here some things:
I don't think the CHARSET="iso8859-1" from your sysconfig/i18n (this will be replicated in sysconfig/knoppix, which I believe is more important for Knoppix) file has the characters you are looking for. However, I am not exactly sure which parts of Knoppix depend on this setting. I have fixed this by changing the theme (which also includes different fonts) in the Controll Center: K Menu -> Controll Center -> Appearance & Themes -> Fonts.
I eventually booted Knoppix with every cheatcode that has some localization: lang, tz, keyboard, xkeyboard, and I still had to manually edit KDEKEYBOARDS in sysconfig/keyboard and sysconfig/knoppix. Note that if you use myconfig, then it will overwrite all these cheatcodes - I have a hack to get around this, if you're interested. After all this, my system seems to be working fine.

joakimk
06-06-2007, 09:56 AM
Somehow, this worked out...
echo LANG gives ISO-8859-1 and my i18n file contains:

LANG="en_US.UTF-8"
COUNTRY="no"
LANGUAGE="no"
CHARSET="en_US.UTF-8"
XMODIFIERS=""
(note that "no" is abbrev. for Norway)

I rebooted Knoppix using Ctrl-Alt-Backspace. Hope I'm able to redo this on the other PC's I need to handle accents...

-J

330toSRT8
06-06-2007, 07:06 PM
joakimk, I'm a little confused. How exactly did you solve it? By changing the theme or editing the i18n file or something else? Thanks for your help.

SiKing
06-07-2007, 10:07 AM
Somehow, this worked out...
echo LANG gives ISO-8859-1 and my i18n file contains:

LANG="en_US.UTF-8"
COUNTRY="no"
LANGUAGE="no"
CHARSET="en_US.UTF-8"
XMODIFIERS=""
(note that "no" is abbrev. for Norway)

I rebooted Knoppix using Ctrl-Alt-Backspace. Hope I'm able to redo this on the other PC's I need to handle accents...
All this does not seem right. My sysconfig/i18n looks like this:

LANG="en_IE@euro"
COUNTRY="ie"
LANGUAGE="ie"
CHARSET="iso8859-15"
XMODIFIERS=""
All this would seem to suggest that only Knoppix-specific stuff depends on these files. For example, /usr/sbin/saveconfig (which is the Knoppix utility to save the user's configuration) starts with sourcing sysconfig/knoppix (which also contains all the information from sysconfig/i18n) and then makes some decisions based on the LANGUAGE setting.

I suspect your problem/solution lies elsewhere, but I have no idea where... Sorry. :?

Capricorny
07-01-2007, 10:54 AM
[quote=joakimk]Somehow, this worked out...
echo LANG gives ISO-8859-1 and my i18n file contains:

LANG="en_US.UTF-8"
COUNTRY="no"
LANGUAGE="no"
CHARSET="en_US.UTF-8"
XMODIFIERS=""
(note that "no" is abbrev. for Norway)

I suspect your problem/solution lies elsewhere, but I have no idea where... Sorry. :?
Well, I ran into the same problem (also from Norway), and joakimk's solution works just fine for me, too. Do we need to go any further with this, then?