[GIS] GeoJSON attributes encoding limitation

encodinggeojsonogr

I have problem when trying to encode attribute values in latin1 using OGR GeoJSON driver. Accent char are not displayed correctly. Is the GeoJSON encoding is limited to UTF-8?

I can't find any info about this in specs. Can someone try to encode a GeoJSON in latin1 to see if it works?

Best Answer

GeoJSON is an extension of JSON, and you will find in RFC7159

JSON text SHALL be encoded in UTF-8, UTF-16, or UTF-32.  The default
encoding is UTF-8, and JSON texts that are encoded in UTF-8 are
interoperable in the sense that they will be read successfully by the
maximum number of implementations; there are many implementations
that cannot successfully read texts in other encodings (such as
UTF-16 and UTF-32).

For that reason, nobody has implemented latin encoding within OGR.