Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

JSON.parse UTF-8 problem


I have a problem when parsing a JSON-response array from a webservice I have built in PHP, returning a SQL-result from a mysql db in UTF-8.

The element I would like to get has swedish characters (å,ä,ö).

So I can't get the value like I can with the others:

var temp = json[2].Omgång;

The above doesn't work.
The compiler complains about the "å" in the example above.
I also tried to replace the "å" with the utf-8 code for the character, since the json array has the "å" encoded in utf-8 ("backslash"u00e5)

What is the most simple way to come around this?
JSON.stringify may be one way maybe, but then I need to have another array.

Someone who have a better and simple suggestion?

— asked April 25th 2010 by Christian Andersson
  • json
  • utf-8

1 Answer

  • Accepted Answer

    var temp = json[2]["Omgång"];
    — answered April 25th 2010 by Damien Elmes
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.