Browse Source

write utf-8

j 2 months ago
parent
commit
349383ff39
1 changed files with 3 additions and 3 deletions
  1. 3
    3
      oml/update.py

+ 3
- 3
oml/update.py View File

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