From: J.H.Kim on
Hi, everyone

I'm using debian linux and my locale is EUC-KR.
When I use Korean language in source such as printf,
the character is broken in console just showing "????".

How can I solve this problem?

Thanks in advance.

Best Regards,
J.Hwan Kim
From: Tom Anderson on
On Tue, 13 Jul 2010, J.H.Kim wrote:

> I'm using debian linux and my locale is EUC-KR. When I use Korean
> language in source such as printf, the character is broken in console
> just showing "????".
>
> How can I solve this problem?

It's probably a mismatch between the character encoding being used by
java, your shell, your X server, and so on.

I assume that you have a normal text editor which can happily edit text
files containing Korean characters.

First, try redirecting the console output to a file:

java PrintingProgram >test.txt

Then look at that file with your normal text editor.

If that file looks okay, then the problem is that your console is not
using the right character encoding. I don't know how you'd fix that; i
suggest you ask on a Korean linux newsgroup.

If that file looks like nonsense, then the problem is probably that java's
default character encoding is not set correctly. It may be using UTF-8 or
ISO-Latin-1 when it should be using ISO2022KR or something. Or that it's
using ISO-Latin-1 when it should be using UTF-8. Whatever, the solution is
probably to set the file.encoding system property to the name of the
appropriate character encoding when you start java.

There's probably a way to set the character encoding globally, so java
uses it as a default, but i don't know what that is.

tom

--
The revolving disc of plagues is particularly fun. -- greengolux
From: Roedy Green on
On Tue, 13 Jul 2010 23:27:51 +0900, "J.H.Kim" <frog1120(a)gmail.com>
wrote, quoted or indirectly quoted someone who said :

>
>I'm using debian linux and my locale is EUC-KR.
>When I use Korean language in source such as printf,
>the character is broken in console just showing "????".

The console is constrained by the OS's console support. The Korean
set is only supported by the GUI, and then only with fonts that
support Korean.

There might be a way to change the encoding of the console, perhaps
with some OS configuring command.

I have treated the console as a debugging tool, presumably capable
only of ASCII.
--
Roedy Green Canadian Mind Products
http://mindprod.com

You encapsulate not just to save typing, but more importantly, to make it easy and safe to change the code later, since you then need change the logic in only one place. Without it, you might fail to change the logic in all the places it occurs.