Skip to content

Commit e488219

Browse files
author
Stan van Rooy
committed
fix: encode save file to utf-8
1 parent fc0a966 commit e488219

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

instauto/api/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ def save_to_disk(self, file_name: str, overwrite: bool = False) -> bool:
161161
file_mode = "w" if not overwrite else "w+"
162162

163163
try:
164-
f = open(file_name, file_mode)
164+
f = open(file_name, file_mode, encoding="utf-8")
165165
as_json = self.to_json()
166166
f.write(as_json)
167167
except Exception as e:
@@ -172,7 +172,7 @@ def save_to_disk(self, file_name: str, overwrite: bool = False) -> bool:
172172

173173
@classmethod
174174
def initiate_from_file(cls, file_name: str) -> "ApiClient":
175-
with open(file_name, "rb") as f:
175+
with open(file_name, "r", encoding="utf-8") as f:
176176
try:
177177
return cls.from_json(f.read())
178178
except orjson.JSONDecodeError:

0 commit comments

Comments
 (0)