Tuesday 19 December 2017

ogr - GeoJSON attributes encoding limitation


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?



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.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...