View Full Version : Why does Ext convert characters in my dataset?

1 Oct 2009, 6:11 AM

In my app I have a combobox which receives the following data:

{"NAME":"AAM (Årdal)","ID":51},
{"NAME":"ASU (Sunndal)","ID":55},
{"NAME":"HAK (Karmøy)","ID":60},
{"NAME":"LUC (Lucè)","ID":66},
... and more
.. but when the data is displayed in my app, it looks like this:

AAM (?rdal)
ASU (Sunndal)
HAK (Karm?y)
LUC (Luc?)
It would seem like Ext is converting the characters into a different character encoding. How can I make Ext NOT convert the characters? I like what I get from my DB. ;)

1 Oct 2009, 6:19 AM
Ext does not do anything.

This is a matter between your server and your browser.

1 Oct 2009, 12:48 PM
This is a matter between your server and your browser.
If this was the case, I would expect Firebug to report the same text as ExtJS displays in it's console. The JSON I provide in the topmost code box, is fetched from Firebugs console after a GET operation, and the bottom code box is fetched by copy & paste from firebugs HTML element inspector at display time.

The data was one thing one the server, remained the same when the browser received it, but somehow changed when ExtJS had processed it in Store and displayed it.

I've seen this before when I try to convert none UTF-8 data to UTF-8. Could this be the case here?

1 Oct 2009, 1:38 PM
You must ensure that your server encodes the Unicode correctly, and sets the character encoding header to reflect that.

2 Oct 2009, 4:35 AM
My index html includes the following:

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">My java servlet throws out the following:

httpServletResponse.setCharacterEncoding("iso-8859-1");and this is the response header (fetched from firebug):

Response Headers
Date Fri, 02 Oct 2009 12:27:32 GMT
Content-Length 7730
Content-Type text/plain
X-Powered-By Servlet/2.5 JSP/2.1

How can I communicate to Ext that I do not display unicode?

2 Oct 2009, 4:44 AM
Hmm... Got it:
httpServletResponse.setContentType("text/plain; charset=iso-8859-1");