2

Running mapserver 6.4.1, gdal 1.14.3 I try to output some WFS features using outputformat=geojson. The relevant bits of the mapfile are appended below.

Everything works fine, but unicode characters are still encoded as ISO-8859-1 when using geojson. The OGR/GML driver outputs utf-8 correctly. OGR/CSV also fails and uses ISO-8859-1.

I get for example "gatenavn": "Langørhøgden" with outputformat=geojson and <ms:gatenavn>Langørhøgden</ms:gatenavn> in GML

Is there any dataset or layer creation option or mapfile parameter I am missing?

 (in WEB/METADATA)
 "wfs_getfeature_formatlist" "geojson,csv,ogrgml"
 "wfs_encoding" "UTF-8"


 OUTPUTFORMAT
  NAME "geojson"
  DRIVER "OGR/GEOJSON"
  MIMETYPE "application/json; subtype=geojson"
  FORMATOPTION "STORAGE=stream"
  FORMATOPTION "FORM=SIMPLE"
  FORMATOPTION "LCO:COORDINATE_PRECISION=5"
 END
2

Turns out it is as easy as this:

MIMETYPE "application/json; subtype=geojson; charset=utf-8"

Without the setting, no content encoding is returned by the server.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.