PDA

View Full Version : Jsonreader extended ascii fails



jimtyp
18 Sep 2009, 10:40 AM
I have a grid that displays data from a json store. If the data sent from the server has an extended ascii character in it, for example: Muņoz, then no data shows up in the grid.

Anyone have a fix or workaround for this?

Animal
18 Sep 2009, 11:00 AM
What encoding does your server use to convert the characters into the byte stream that is sent to the browser?

Does it correctly set the Content-Type header to inform the browser of this so that it can decode the byte stream back into Unicode?

jimtyp
18 Sep 2009, 11:02 AM
Currently I don't do anything so that's probably it. Do you have an example what I can set that to so Json will read the extended ascii characters?

Animal
18 Sep 2009, 11:08 AM
You should know your own server technology. You tell it how to encode, and you tell it what HTTP headers to send which contain information about this. I only know Java/JEE.

jimtyp
18 Sep 2009, 11:11 AM
That's what I'm using. Do you think response.setCharacterEncoding("utf-8"); would work?

Animal
18 Sep 2009, 11:22 AM
Yes. And also set the header.



response.setHeader("Content-type", "application/json; charset=UTF-8");
response.setCharacterEncoding("UTF-8");


Before you acccess the writer.

As someone discovered just a few hours ago on these boards!

http://www.extjs.com/forum/showthread.php?t=80746

jimtyp
18 Sep 2009, 11:26 AM
Excellent! Thank you very much!

Please excuse my ignorance, could someone move this topic to help? Not a bug.