• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

specifying character set when compiling

 
Kevin Tysen
Ranch Hand
Posts: 255
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The javac command takes an optional -encoding argument.
 
Kevin Tysen
Ranch Hand
Posts: 255
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I saved my .java file (called JsBuild.java) in UTF8, then typed
javac -encoding UTF8 JsBuild.java

but then I got an error message in Japanese, which, translated to English, is something like this:

JsBuild.java:1: \65279 is an improper character.
?import java.io.BufferedWriter;
^

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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic