mirror of
https://gitflic.ru/project/photopea-v2/photopea-v-2.git
synced 2025-07-01 10:25:32 +00:00
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:
parent
15c1cb088a
commit
528742b32a
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user