> -----------------test.java-------------------------
> public class test
[quoted text clipped - 7 lines]
> ----------------------------------------------------
> I saved it as UTF-8 then compiled it with,
Which is in general not a very clever idea. If you are interested in
maximum source code portability and least trouble with tools use only
Latin-1 or better yet ASCII in Java source code. Add everything outside
this range via Unicode escape sequences \uxxxx. Better yet, externalize
all such strings and use a resource bundle (which must be in ASCII or
Latin-1 and contain Unicode escape sequences).
When doing so, the JDK tool native2ascii and a decent build system are
your friends to generate the files with the escape sequences.
> javac test.java -encoding utf-8
> It compiled successfully but when I ran it, the output was
> ??,???
> This is not what I expected, the output should have been,
> 学校,한국어
You don't have the right font, or you have a mismatch between the
console's font encoding and the System.out's font encoding.
May I suggest that you reserve a few hours and study Sun's
internationalization tutorial, plus their information regarding font
handling?
> Plus, when I edited the java file with Notepad, it seems like
> BOM(Byte Order Mark) is added. But then the javac says,
[quoted text clipped - 3 lines]
> ^
> 1 error
As I wrote, storing Java source code in anything but ASCII or Latin-1 is
not really a clever idea.
/Thomas

Signature
The comp.lang.java.gui FAQ:
http://gd.tuwien.ac.at/faqs/faqs-hierarchy/comp/comp.lang.java.gui/
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq