Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions python/docs/redirects/redirects.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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)


Expand All @@ -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:
Expand Down