Bug Tracker

Opened 9 years ago

Closed 9 years ago

#6851 closed bug (worksforme)

JSON-Error

Reported by: Flocke Owned by:
Priority: Milestone: 1.4.2
Component: unfiled Version: 1.4.2
Keywords: Cc:
Blocked by: Blocking:

Description

jQuerry can not do this: var lex=jQuery.parseJSON('[{"ID":"1","TITLE":"Lag","CONTENT":"Verz\u00f6gerung im Spiel ausgel\u00f6st durch Probleme bei der Netzwerkverbindung."},{"ID":"2","TITLE":"Warzone","CONTENT":"Kriegsgebiet in der Mitte der Karte."},{"ID":"3","TITLE":"Beschw\u00f6rer","CONTENT":"Unterklasse des Magiers."},{"ID":"4","TITLE":"Holas","CONTENT":"Spanisch f\u00fcr Hallo."},{"ID":"5","TITLE":"Aggro ziehen","CONTENT":"Die Aufmerksamkeit des Feindes auf sich ziehen."},{"ID":"6","TITLE":"XP","CONTENT":"Erfahrungspunkte"},{"ID":"7","TITLE":"Schlumpf","CONTENT":"Alse"},{"ID":"8","TITLE":"Algaros","CONTENT":"Fort in der Syrtischen Warzone."},{"ID":"9","TITLE":"Ziege","CONTENT":"Ein Utghaer aus Alsius."},{"ID":"10","TITLE":"CUNTerstrike","CONTENT":"Anspielung auf das Spiel Counterstrike."},{"ID":"11","TITLE":"no hablo ingles","CONTENT":"Spanisch f\u00fcr: Ich spreche kein Englisch."},{"ID":"12","TITLE":"OMG","CONTENT":"OMG=Oh mein Gott."},{"ID":"13","TITLE":"LOL","CONTENT":"LOL steht f\u00fcr \u0022laughing out loud\u0022=ich lache"},{"ID":"14","TITLE":"RP","CONTENT":"Realm Points=Punkte, die man f\u00fcr das T\u00f6ten von Reichsfeinden bekommt."},{"ID":"15","TITLE":"xD","CONTENT":"Lachendes Gesicht."}]');

Change History (1)

comment:1 Changed 9 years ago by dmethvin

Resolution: worksforme
Status: newclosed

The problem is here:

"LOL steht f\u00fcr \u0022laughing out loud\u0022=ich lache"

Those \u0022 characters are double-quotes (") and when your literal string is processed by the Javascript interpreter it turns them into double quotes. You can double up the backslashes so that Javascript will leave the \uXXXX intact for JSON.

"LOL steht f\\u00fcr \\u0022laughing out loud\\u0022=ich lache"
Note: See TracTickets for help on using tickets.