Internationalization problem

H

horseface

Hi everybody.

I'm trying to make a Web application in non-English language. I need it to
contain special characters from my language (èæ¾¹ð).

When I put those chars in JSP, it works fine. However, when I embed them in
Java code, the Strings containig them display ?s instead of them. For
instance
èaèiæi becomes ?a?i?i. Very irritating.

Can someone tell me how Java manages this? Changing the code page for
Explorer doesn't do anything since the source page already contains ?s.

Thanks for any kind of help. Cheers!
 
A

Anton Spaans

horseface said:
Hi everybody.

I'm trying to make a Web application in non-English language. I need it to
contain special characters from my language (èæ¾¹ð).

When I put those chars in JSP, it works fine. However, when I embed them in
Java code, the Strings containig them display ?s instead of them. For
instance
èaèiæi becomes ?a?i?i. Very irritating.

Can someone tell me how Java manages this? Changing the code page for
Explorer doesn't do anything since the source page already contains ?s.

Thanks for any kind of help. Cheers!

How do you form those strings in your Java code.
If you use constants, use the \u escape for specifying those special chars.
E.g.

String aString = "Here follows a Roman Numeral Twelve: \u216B";

Don't do this:

String aString = "Here follows a Roman Numeral Twelve: ?";
(i don't know whether this last string will show up OK in your
newsreader, though)
-- Anton.
 
A

Anton Spaans

Anton Spaans said:
How do you form those strings in your Java code.
If you use constants, use the \u escape for specifying those special chars.
E.g.

String aString = "Here follows a Roman Numeral Twelve: \u216B";

Don't do this:

String aString = "Here follows a Roman Numeral Twelve: ?";
(i don't know whether this last string will show up OK in your
newsreader, though)

Trying the last few lines again, but sending it in UTF-8 now.... :)
==========================================

Don't do this:

String aString = "Here follows a Roman Numeral Twelve: ?";
(i don't know whether this last string will show up OK in your
newsreader, though)
 
D

David Van de Voorde

You should declare and generate your page as Unicode. Java internally
handles the UTF-16 Unicode implementation.
Probably, you're using 8-bit characters, which off course will be
interpreted according to your local codepage setting. This means that all
accented characters are not displayed correctly. (Eg. a "French E accent"
might appear as a "Greek alfa".)
Unicode allows for a unique representation of all possible characters
(French, Greek, Chinese, ...), that way being independent of some "regional
options".

David.
 
G

Guest

How do you form those strings in your Java code. If you use constants, use
the \u escape for specifying those special chars. E.g.

String aString = "Here follows a Roman Numeral Twelve: \u216B";

Don't do this:

String aString = "Here follows a Roman Numeral Twelve: ?"; (i don't
know whether this last string will show up OK in your
newsreader, though)
-- Anton.

One other quick note: Escape your HTML! Escape any characters above 127
and any other character with special meaning in HTML(such as double and
single quotes, ampersand, and less than / greater than).

HTH,
La'ie Techie
 
A

Anton Spaans

La?ie Techie said:
One other quick note: Escape your HTML! Escape any characters above 127
and any other character with special meaning in HTML(such as double and
single quotes, ampersand, and less than / greater than).

HTH,
La'ie Techie

Good note, La'ie! :)

You can escape in HTML using 'entity references'. For Unicode refs, use the
notation, where xxxx is a 4 or 5 digit decimal number.
E.g. #&0032; is a space,   is a non-break space, and my roman numeral
twelve would then be Ⅻ .

-- Anton.
 

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

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,141
Latest member
BlissKeto
Top