Can compiled java with simplified chinese embedded?

W

Wandy Tang

Dear All,

I am making a servlet that will display simplified chinese character, the
character seems normal during open with notepad but when compling, it has
error message says

"gb.java:1: illegal character: \65279"
import java.io.*; // it should says import java.io.*

I use "javac.exe -encoding UTF-8 gb.java" command for compling.

The servlet has saved as a UTF-8 format file.

Regards
Wandy
 
T

Thomas Weidenfeller

Wandy said:
I am making a servlet that will display simplified chinese character, the
character seems normal during open with notepad but when compling, it has
error message says

"gb.java:1: illegal character: \65279"
import java.io.*; // it should says import java.io.*

I use "javac.exe -encoding UTF-8 gb.java" command for compling.

BOM mark, remove it. See a similar discussion from a few days ago:

http://groups.google.com/[email protected]

/Thomas
 
M

Michael Borgwardt

Wandy said:
I am making a servlet that will display simplified chinese character, the
character seems normal during open with notepad but when compling, it has
error message says

"gb.java:1: illegal character: \65279"
import java.io.*; // it should says import java.io.*

I use "javac.exe -encoding UTF-8 gb.java" command for compling.

The servlet has saved as a UTF-8 format file.

Character 65279 (FEFF in hex) is a byte order mark, apparently inserted
by your editor. For UTF-8, this serves no purpose, and it seems the Java
compiler disallows it completely (as byte order marks are generally not
used in Java).

Look through the configuration options of your editor to see whether it
can be made not to write the byte order mark, otherwise look for a different
editor.
 
S

Sam

Wandy Tang said:
Dear All,

I am making a servlet that will display simplified chinese character, the
character seems normal during open with notepad but when compling, it has
error message says

"gb.java:1: illegal character: \65279"
import java.io.*; // it should says import java.io.*

I use "javac.exe -encoding UTF-8 gb.java" command for compling.

The servlet has saved as a UTF-8 format file.

Regards
Wandy


Wandy,

I don't know the answer to your question, but I have one of my own.
Why do you need to store the source code as UTF-8? You can use
encoding/decoding on input/ output as required. I've played around
with displaying Japanese in Java and have never had to worry about the
source code encoding.

Regards,
Sam90
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top