Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Json parsing with unicode characters

Tags:

json

unicode

i have a json file with unicode characters, and i'm having trouble to parse it. I've tried in Flash CS5, the JSON library, and i have tried it in http://json.parser.online.fr/ and i always get "unexpected token - eval fails"

I'm sorry, there realy was a problem with the syntax, it came this way from the client.

Can someone please help me? Thanks

like image 336
André Alçada Padez Avatar asked Dec 27 '22 20:12

André Alçada Padez


2 Answers

Quoth the RFC:

JSON text SHALL be encoded in Unicode. The default encoding is UTF-8.

So a correctly encoded Unicode character should not be a problem. Which leads me to believe that it's not correctly encoded (maybe it uses latin-1 instead of UTF-8). How did you create the file? In a text editor?

like image 190
Mike Baranczak Avatar answered Dec 30 '22 09:12

Mike Baranczak


There might be an obscure Unicode whitespace character hidden in your string.

This URL contains more detail:

http://timelessrepo.com/json-isnt-a-javascript-subset

like image 22
knb Avatar answered Dec 30 '22 09:12

knb