How to use -encoding option to compile a UTF-8 java source file

I used

javac -encoding UTF-8 javafile.java

to compile the java source file "javafile.java" which is saved by UTF-8. But got errors.

Although when I save the file "javafie.java" as ANSI file, and used

javac javafile.java

I got success.

May I get some helps for compiling the UTF-8 java file?

[343 byte] By [wangquanyong] at [2007-9-26 21:51:55]
# 1
use like thisjavac -encoding utf-8 JavaFile.javalowecase : utf-8Regards Altug
albilgin at 2007-7-4 0:34:05 > top of Java-index,Developer Tools,Java Compiler...
# 2
use like thisjavac -encoding utf-8 JavaFile.javalowecase : utf-8Regards Altug
albilgin at 2007-7-4 0:34:05 > top of Java-index,Developer Tools,Java Compiler...
# 3

> lowecase : utf-8

Uppercase works just fine. However javac does not recognize three byte UTF-8 BOM at the beginning of a source file (two byte BOM in case of UTF-16 gets recognized correctly).

So it's necessary to cut of that EF BB BF sequence at the beginning of a source file and it'll work fine.

Stasys at 2007-7-4 0:34:05 > top of Java-index,Developer Tools,Java Compiler...