Specify UTF-8 encoding when reading and writing files in find_and_replace

This works around an issue on Windows --- by default, Windows uses CP1252, while the files from photopea.com are encoded in UTF-8.
This commit is contained in:
DUOLabs333 2024-12-23 23:40:10 -05:00
parent 15c1cb088a
commit 528742b32a

View File

@ -166,10 +166,10 @@ if '--templates' in sys.argv:
os.remove(tpl)
def find_and_replace(file,find,replace):
with open(os.path.join(root,file),'r') as pp:
with open(os.path.join(root,file),'r', encoding="utf-8") as pp:
file1=pp.read()
file1=file1.replace(find,replace)
with open(os.path.join(root,file),'w') as pp:
with open(os.path.join(root,file),'w', encoding="utf-8") as pp:
pp.write(file1)
#Allow any port to be used