Merge pull request #938 from 6rzes/fix_encoding_charmap_utf

fix  Error: 'charmap' codec can't encode character '\u0142' in position 99: character maps to<undefined>
This commit is contained in:
Pi
2023-04-13 16:17:08 +01:00
committed by GitHub

View File

@@ -38,7 +38,7 @@ def write_to_file(filename, text):
directory = os.path.dirname(filepath)
if not os.path.exists(directory):
os.makedirs(directory)
with open(filepath, "w") as f:
with open(filepath, "w", encoding='utf-8') as f:
f.write(text)
return "File written to successfully."
except Exception as e: