27 lines
1.1 KiB
Python
27 lines
1.1 KiB
Python
import re, shutil
|
|||
|
|
|
||
|
|
# Copy with correct encoding
|
||
|
|
files_to_fix = [
|
||
|
|
("bot-go/internal/helpers/helpers.go", "write-go/internal/helpers/helpers.go"),
|
||
|
|
("bot-go/internal/tgcore/tgcore.go", "write-go/internal/tgcore/tgcore.go"),
|
||
|
|
("bot-go/internal/tghandlers/tghandlers.go", "write-go/internal/tghandlers/tghandlers.go"),
|
||
|
|
("bot-go/internal/sessions/sessions.go", "write-go/internal/sessions/sessions.go"),
|
||
|
|
("bot-go/internal/adminpanel/adminpanel.go", "write-go/internal/adminpanel/adminpanel.go"),
|
||
|
|
("bot-go/internal/writeserver/writeserver.go", "write-go/internal/writeserver/writeserver.go"),
|
||
|
|
]
|
||
|
|
|
||
|
|
base = r"E:\GitHub\blog"
|
||
|
|
|
||
|
|
for src_rel, dst_rel in files_to_fix:
|
||
|
|
src = base + "\\" + src_rel
|
||
|
|
dst = base + "\\" + dst_rel
|
||
|
|
with open(src, "rb") as f:
|
||
|
|
content = f.read()
|
||
|
|
text = content.decode("utf-8")
|
||
|
|
text = re.sub(r'writebot/internal/', 'write-server/internal/', text)
|
||
|
|
text = text.replace('writebot/internal/config', 'write-server/internal/botconfig')
|
||
|
|
with open(dst, "wb") as f:
|
||
|
|
f.write(text.encode("utf-8"))
|
||
|
|
print(f"OK: {dst_rel}")
|
||
|
|
|
||
|
|
print("All fixed with proper UTF-8")
|