samkwitty

Can't Get I18N To Work (Japanese In This Case)

Recommended Posts

I am trying to display some Japanese text in the charts.

I am passing the data to the chart via a URL.

When I look at what is returned in FireFox the XML looks correct and you can see the right Japanese words in it.

 

See below...

 

<chart caption="バイタルサイン" subCaption="Heart, Breathing and Motion">
...
</chart>

 

However when it is displayed in the chart it looks wrong. See attached image. The title is displaying some other characters. I know it is not a page encoding issue because when the encoding is wrong you get "????" not funny characters.

 

The HTTP header for the data looks like so:

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: text/xml; utf-8;charset=UTF-8
Transfer-Encoding: chunked
Content-Encoding: gzip
Vary: Accept-Encoding

 

What am I missing?

post-2293-007144400 1289602608_thumb.jpg

Share this post


Link to post
Share on other sites

Turns out I was missing the BOM characters.

 

However, since I am using a JSP to generate the graph as a scriplet I could not do:

response.getOutputStream().write( new byte[]{(byte)0xEF, (byte)0xBB, (byte)0xBF} );

 

If anyone runs into this in the future you can do:

<% out.write(new String(new byte[]{(byte)0xEF, (byte)0xBB, (byte)0xBF}, 0, 3, "utf-8")); %>

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now