File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes specifying character set when compiling Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "specifying character set when compiling" Watch "specifying character set when compiling" New topic

specifying character set when compiling

Kevin Tysen
Ranch Hand

Joined: Oct 12, 2005
Posts: 255
If I have a source file with String literals which are in Japanese, I want to make sure the String literals are read correctly by the compiler. How do I do that?
Jeff Verdegan

Joined: Jan 03, 2004
Posts: 6109

The javac command takes an optional -encoding argument.
Kevin Tysen
Ranch Hand

Joined: Oct 12, 2005
Posts: 255
I saved my .java file (called in UTF8, then typed
javac -encoding UTF8

but then I got an error message in Japanese, which, translated to English, is something like this: \65279 is an improper character.

The first line of the file is an import statement, with no character in front of the word "import".
I assume that the question mark is there because the character \65279 cannot be displayed correctly.
But I have no idea how that character got there, or how to get rid of it.
I agree. Here's the link:
subject: specifying character set when compiling
Similar Threads
does garbage collector runs in a loop?
Garbage from MindQ
String Literals and Garbage Collection.
annoying JSP error
Garbage Collection on object with null reference.