PDA

View Full Version : AJAX call dieing when encoding is cp1252



primitiveorigin
24 Feb 2009, 3:15 AM
Hi,

For reasons out of my control, the only character encoding that I can use in my EXTJS application is cp1252. This is the windows encoding scheme that is used by default on the OS.

I am using tomcat to serve some JSON data to my browser and if I include the lines:



request.setCharacterEncoding("cp1252");
response.setCharacterEncoding("cp1252");


Just before I send the data back from the servlet the ajax call dies with an error like:



Error: System error: -1072896658
Code: 0


Is there something I can set somewhere in EXTJS that can enable this to work?

Thanks, Jared.

hendricd
24 Feb 2009, 4:53 AM
@primitiveorigin -- Afraid your options are rather limited. Browsers typically only support (the prefered and assures the most compatibility with international character sets) UTF-8 encoding in their xmlhttprequest implementations.

If you can't change the server's current response encoding to UTF-8, you may have to proxy the response some how and get it converted to UTF-8 so the browser(s) can consume it.

primitiveorigin
24 Feb 2009, 5:01 AM
The problem is to preserve funny characters like the euro and pound characters that are already being represented in cp1252 encoding and not easily converted to other encoding schemes.

This actually works fine when the request is done in the usual way with a http request from the browser, just dies when an EXTJS call is done on the same link.

I guess I could try converting the characters to something neutral like
€ and
£ on their way out, but was hoping for a cleaner way to do things.

Thanks, Jared.