diff options
| author | Andreas Weinzierl <20560137+aWeinzierl@users.noreply.github.com> | 2021-01-27 23:31:33 +0100 |
|---|---|---|
| committer | Andreas Weinzierl <20560137+aWeinzierl@users.noreply.github.com> | 2021-01-27 23:31:33 +0100 |
| commit | 0f7b678f5776a940b590e55381eba5ccb511d9d7 (patch) | |
| tree | 56501a9cb8ba5b5fc84c3a264d45dd3fec052a04 /sticker/stickerimport.py | |
| parent | b884a9c3874cfe0eb885bf2b8eaa46a628a9f4a3 (diff) | |
Use utf8-encoding whenever JSON is processed
Diffstat (limited to 'sticker/stickerimport.py')
| -rw-r--r-- | sticker/stickerimport.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sticker/stickerimport.py b/sticker/stickerimport.py index 1bff240..5327cc6 100644 --- a/sticker/stickerimport.py +++ b/sticker/stickerimport.py @@ -71,7 +71,7 @@ async def reupload_pack(client: TelegramClient, pack: StickerSetFull, output_dir already_uploaded = {} try: - with open(pack_path) as pack_file: + with util.open_utf8(pack_path, encoding="utf-8") as pack_file: existing_pack = json.load(pack_file) already_uploaded = {int(sticker["net.maunium.telegram.sticker"]["id"]): sticker for sticker in existing_pack["stickers"]} @@ -99,7 +99,7 @@ async def reupload_pack(client: TelegramClient, pack: StickerSetFull, output_dir doc["body"] = sticker.emoticon doc["net.maunium.telegram.sticker"]["emoticons"].append(sticker.emoticon) - with open(pack_path, "w", encoding="utf-8") as pack_file: + with util.open_utf8(pack_path, "w") as pack_file: json.dump({ "title": pack.set.title, "id": f"tg-{pack.set.id}", |
