Aug-29-2018, 07:06 AM
It's a Windows editor that's been around for about 25 years.
I have yet another encoding issue, this time with geojson :-/
If I use its dump(), UTF8 data is turned into UTF16 (apparently), eg. "Fran\u00e7ois" instead of "François":
Should I use another method than "dump"?
I have yet another encoding issue, this time with geojson :-/
If I use its dump(), UTF8 data is turned into UTF16 (apparently), eg. "Fran\u00e7ois" instead of "François":
with open('input.geojson', encoding='utf-8') as f: gj = geojson.load(f) for track in gj['features']: #NO DIFF with open(track['properties']['name'][0] + '.geojson', 'a+', encoding='utf-8') as f: with open(track['properties']['name'][0] + '.geojson', 'a+') as f: dump(track, f, indent=2) #UnicodeEncodeError: 'charmap' codec can't encode character '\u2194' in position 7: character maps to <undefined> #dump(track, f, indent=2, ensure_ascii=False) #NOT DEFINED #dumps(track, f, indent=2) #AttributeError: encode #dump(track.encode("utf-8"), f, indent=2, ensure_ascii=False)As shown, I found and tried several things, all to no avail.
Should I use another method than "dump"?