From 76bf781c40fcf7a4291759f10cab08c133641136 Mon Sep 17 00:00:00 2001 From: junmin0413 Date: Tue, 26 May 2026 00:08:20 +0900 Subject: [PATCH] docs: use explicit utf-8 encoding in redirects script --- python/docs/redirects/redirects.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/python/docs/redirects/redirects.py b/python/docs/redirects/redirects.py index 69cc942fdfd5..b966005fe02c 100644 --- a/python/docs/redirects/redirects.py +++ b/python/docs/redirects/redirects.py @@ -7,7 +7,7 @@ # Contains single text template $to_url HTML_PAGE_TEMPLATE_FILE = THIS_FILE_DIR / "redirect_template.html" -HTML_REDIRECT_TEMPLATE = HTML_PAGE_TEMPLATE_FILE.open("r").read() +HTML_REDIRECT_TEMPLATE = HTML_PAGE_TEMPLATE_FILE.open("r", encoding="utf-8").read() REDIRECT_URLS_FILE = THIS_FILE_DIR / "redirect_urls.txt" def generate_redirect(file_to_write: str, new_url: str, base_dir: Path): @@ -30,7 +30,7 @@ def generate_redirect(file_to_write: str, new_url: str, base_dir: Path): redirect_page_path.parent.mkdir(parents=True, exist_ok=True) # Write the redirect page - with open(redirect_page_path, "w") as f: + with open(redirect_page_path, "w", encoding="utf-8") as f: f.write(redirect_page) @@ -42,7 +42,7 @@ def main(): base_dir = Path(sys.argv[1]) # Read file - with open(REDIRECT_URLS_FILE, "r") as f: + with open(REDIRECT_URLS_FILE, "r", encoding="utf-8") as f: lines = f.readlines() for line in lines: