Modify

Opened 12 years ago

Closed 11 years ago

Last modified 7 years ago

#8474 closed defect (fixed)

Properly escape GeoJSON

Reported by: oschrenk Owned by: team
Priority: normal Milestone: 13.12
Component: Core Version:
Keywords: Cc:

Description (last modified by skyper)

Right now GeoJSON isn't properly escaped.

  1. It does escape double quote with two slashes. This only makes sense if the GeoJSON code is inlined in JavaScript, as two escaping mechanisms are needed.
  2. It does not escape all characters required by RFC 4627

I suggest using either json-simple's JSONValue#escape method [1] (Apache license) or to adapt gson's sring method [2] (Apache license)

[1] https://code.google.com/p/json-simple/source/browse/trunk/src/main/java/org/json/simple/JSONValue.java
[2] https://code.google.com/searchframe#1W0hTXRl0vg/trunk/gson/src/main/java/com/google/gson/stream/JsonWriter.java&l=532

I was using JOSM to export a GeoJSON layer for Polymaps which choked on double quotes being escaped with two slashes.

Attachments (0)

Change History (4)

comment:1 by skyper, 12 years ago

Description: modified (diff)

escaped numbering.

comment:2 by Don-vip, 11 years ago

Resolution: fixed
Status: newclosed

In 6484/josm:

see #7307, fix #8474 - use org.json as lightweight internal json library (already being used by several plugins)

comment:3 by Don-vip, 11 years ago

Milestone: 13.12 (6502)

comment:4 by stoecker, 7 years ago

Milestone: 13.12 (6502)13.12

Milestone renamed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.