1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-14 16:27:13 +03:00

Fixes File > 'Save Raw Data'

Another str versus bytes issue.  We *do* need the .encode('utf-8') in
this case, else it will assume Windows cp1252 encoding which then can't
encode some characters.  So we switch to binary file mode instead.
This commit is contained in:
Athanasius 2019-09-12 12:17:28 +01:00
parent 753fdedbdf
commit a56c48437b

View File

@ -687,7 +687,7 @@ class AppWindow(object):
initialdir = config.get('outdir'),
initialfile = '%s%s.%s.json' % (data.get('lastSystem', {}).get('name', 'Unknown'), data['commander'].get('docked') and '.'+data.get('lastStarport', {}).get('name', 'Unknown') or '', strftime('%Y-%m-%dT%H.%M.%S', localtime())))
if f:
with open(f, 'wt') as h:
with open(f, 'wb') as h:
h.write(json.dumps(data, ensure_ascii=False, indent=2, sort_keys=True, separators=(',', ': ')).encode('utf-8'))
except companion.ServerError as e:
self.status['text'] = str(e)