Bug Tracker

Modify

Ticket #6851 (closed bug: worksforme)

Opened 3 years ago

Last modified 3 years ago

JSON-Error

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

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

comment:1 Changed 3 years ago by dmethvin

  • Status changed from new to closed
  • Resolution set to worksforme

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"

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.