wavded / ogre

ogr2ogr geojson-focused web client
http://ogre.adc4gis.com
MIT License
266 stars 79 forks source link

Add force utf-8 option #88

Closed yuhangch closed 3 years ago

yuhangch commented 3 years ago

Add force encoding utf-8 option for "Convert from GeoJSON"

For properties use key (unicode) like this example:

{ "type": "FeatureCollection",
  "features": [{
    "type": "Feature",
    "geometry": { "type": "Point", "coordinates": [102.0, 0.5] },
    "properties": { "名字": "value0" }
  }]
}

The result from ogr2ogr can't output attribute information correctly:

Ogr_58008b32173- Features Total 1, Fiitered 1, Selected O

Considerin data similar to the above, I want to add an option to handle this situation. From this post, I add this to force utf-8 encoding:

if ('forceUTF8' in req.body) {
      ogr.options(['-lco', 'ENCODING=UTF-8'])
}