PDA

View Full Version : Problems with HTML encoded Text



pajamabob
25 Aug 2011, 11:18 AM
Updateing

I am encoding special characters in the JSON between the server and my EXT application. The following text looks just fine when displayed in a grid column.
Json value = Adrián Báltre
Value in column = Adrián Báltre

However, when displayed a text field, the html codes are displayed rather than the actual characters.

Value in text field = Adrián Báltre

Any clue how I can fix this?

mschwartz
25 Aug 2011, 12:12 PM
Don't encode the values on the server side..

pajamabob
25 Aug 2011, 12:18 PM
If I do not encode, the json is not properly formed and can not be decoded on the client side. I am using single quotes in my Json so that it can be consumed by webkit browsers. This is really not an option.

mschwartz
25 Aug 2011, 12:19 PM
Why would the JSON be malformed?

raz0r1
25 Aug 2011, 12:23 PM
if you save your data as utf-8 (database or file or whatever) you can simply use


echo "[".json_encode(Array/Object)."]";


this encode the whole data and extjs can read it.

try with and without "[", "]" sometimes that makes the difference.

hope that helps