Skip to content

Commit

Permalink
fix for UnicodeDecodeError
Browse files Browse the repository at this point in the history
  • Loading branch information
ertugrul-dmr committed May 4, 2023
1 parent 959ef18 commit 4740ad0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions library/common_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,11 +310,11 @@ def add_pre_postfix(
caption_file_path = os.path.join(folder, caption_file_name)

if not os.path.exists(caption_file_path):
with open(caption_file_path, 'w') as f:
with open(caption_file_path, 'w', encoding="utf8") as f:
separator = ' ' if prefix and postfix else ''
f.write(f'{prefix}{separator}{postfix}')
else:
with open(caption_file_path, 'r+') as f:
with open(caption_file_path, 'r+', encoding="utf8") as f:
content = f.read()
content = content.rstrip()
f.seek(0, 0)
Expand Down

0 comments on commit 4740ad0

Please sign in to comment.