Iternationalization problem continues

H

horseface

Me again, still getting trouble with all the ?s showing up in my non-English
HTML pages. I'll try to detail my problem more clearly now.

In the Java code, I put unicode chars, for instance insteadof "¹ip" I write
"\u0161ip". Process goes down something like this:

1. JavaBean defines a String ("Here is a \u0161ip").
2. JSP page uses a bean to incorporate this String inside a HTML page.
3. HTML page gets shown in IE.

However somewhere along the line this char get turned into "?ip" in the
SOURCE HTML. It's not as if the IE shows the character wrongly, the JSP
seems to build the source HTML itself with ?s instead of the special chars.

This is driving me nuts. Can somebody please tell me (as if I'm a 6-year
old) what are the exact steps to get those damn special chars on my page?

Thanks for any kind of assistance. Cheers!


Thanks for any kind of answer. Cheers!
 
A

Alexey Osyatnikov

Try adding the following line to your JSP:
<%@ page

language="java"

contentType="text/html; charset=UTF-8"

pageEncoding="UTF-8"

%>
 
A

Anton Spaans

horseface said:
Me again, still getting trouble with all the ?s showing up in my non-English
HTML pages. I'll try to detail my problem more clearly now.

In the Java code, I put unicode chars, for instance insteadof "¹ip" I write
"\u0161ip". Process goes down something like this:

1. JavaBean defines a String ("Here is a \u0161ip").
2. JSP page uses a bean to incorporate this String inside a HTML page.
3. HTML page gets shown in IE.

However somewhere along the line this char get turned into "?ip" in the
SOURCE HTML. It's not as if the IE shows the character wrongly, the JSP
seems to build the source HTML itself with ?s instead of the special chars.

This is driving me nuts. Can somebody please tell me (as if I'm a 6-year
old) what are the exact steps to get those damn special chars on my page?

Thanks for any kind of assistance. Cheers!


Thanks for any kind of answer. Cheers!

(BTW: \u0161 is a "Latin small letter S with Caron", not a "superscript 1".)

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 a roman numeral twelve would
be Ⅻ Your "superscript 1" (in java "\u00B9") would then be ¹

All in all, i guess, your Java String would be:

String supOneIP = "¹ip";

-- 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,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top