1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-17 01:22:19 +03:00

Handle non-ASCII Cmdr names.

Fixes .
This commit is contained in:
Jonathan Harris 2015-12-05 04:48:36 +00:00
parent 5c5f27a295
commit a967748d7c
2 changed files with 3 additions and 2 deletions

@ -260,7 +260,7 @@ class AppWindow:
else:
if __debug__: # Recording
with open('%s%s.%s.json' % (data['lastSystem']['name'], data['commander'].get('docked') and '.'+data['lastStarport']['name'] or '', strftime('%Y-%m-%dT%H.%M.%S', localtime())), 'wt') as h:
h.write(json.dumps(data, indent=2, sort_keys=True))
h.write(json.dumps(data, ensure_ascii=False, indent=2, sort_keys=True).encode('utf-8'))
self.cmdr['text'] = data.get('commander') and data.get('commander').get('name') or ''
self.system['text'] = data.get('lastSystem') and data.get('lastSystem').get('name') or ''

@ -12,6 +12,7 @@ from config import applongname, appversion, config
import companion
import outfitting
### upload = 'http://localhost:8081/upload/' # testing
upload = 'http://eddn-gateway.elite-markets.net:8080/upload/'
timeout= 10 # requests timeout
@ -31,7 +32,7 @@ def send(cmdr, msg):
msg['header'] = {
'softwareName' : '%s [%s]' % (applongname, platform=='darwin' and "Mac OS" or system()),
'softwareVersion' : appversion,
'uploaderID' : config.getint('anonymous') and hashlib.md5(cmdr.encode('utf-8')).hexdigest() or cmdr,
'uploaderID' : config.getint('anonymous') and hashlib.md5(cmdr.encode('utf-8')).hexdigest() or cmdr.encode('utf-8'),
}
msg['message']['timestamp'] = time.strftime('%Y-%m-%dT%H:%M:%SZ', time.gmtime(config.getint('querytime') or int(time.time())))