write utf-8

This commit is contained in:
j 2019-03-05 18:23:28 +01:00
parent 7ee959cd11
commit 349383ff39

View file

@ -621,10 +621,10 @@ def migrate_13():
with db.session() as session: with db.session() as session:
revision = -1 revision = -1
qs = changelog.Changelog.query.filter_by(user_id=settings.USER_ID) qs = changelog.Changelog.query.filter_by(user_id=settings.USER_ID)
with open(path, 'w') as fd: with open(path, 'wb') as fd:
for c in qs.order_by('timestamp'): for c in qs.order_by('timestamp'):
data = json.dumps([c.revision, c.timestamp, json.loads(c.data)], ensure_ascii=False) data = json.dumps([c.revision, c.timestamp, json.loads(c.data)], ensure_ascii=False).encode('utf-8')
fd.write(data + '\n') fd.write(data + b'\n')
revision = c.revision revision = c.revision
if revision > -1: if revision > -1:
settings.server['revision'] = revision settings.server['revision'] = revision