mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-18 09:57:40 +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:
parent
753fdedbdf
commit
a56c48437b
@ -687,7 +687,7 @@ class AppWindow(object):
|
|||||||
initialdir = config.get('outdir'),
|
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())))
|
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:
|
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'))
|
h.write(json.dumps(data, ensure_ascii=False, indent=2, sort_keys=True, separators=(',', ': ')).encode('utf-8'))
|
||||||
except companion.ServerError as e:
|
except companion.ServerError as e:
|
||||||
self.status['text'] = str(e)
|
self.status['text'] = str(e)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user