Opened 13 years ago

Last modified 8 years ago

#8474 closed defect

Properly escape GeoJSON — at Version 1

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.

Change History (1)

comment:1 by skyper, 13 years ago

Description: modified (diff)

escaped numbering.

Note: See TracTickets for help on using tickets.