Skip to content

fix(docs): use explicit UTF-8 encoding in redirect generation script - #8304

Open
Xx (Xx-173) wants to merge 1 commit into
microsoft:mainfrom
Xx-173:fix/utf8-redirects-7749
Open

Xx (Xx-173) wants to merge 1 commit into
microsoft:mainfrom
Xx-173:fix/utf8-redirects-7749

Conversation

@Xx-173

Copy link
Copy Markdown

Summary

Fixes #7749. python/docs/redirects/redirects.py reads and writes redirect files using Python's default system encoding. On Windows locales where the default is not UTF-8 (e.g. cp950), this fails with UnicodeDecodeError/UnicodeEncodeError when the files contain non-ASCII characters.

Added explicit encoding="utf-8" to all three file operations:

  • reading the HTML redirect template (HTML_PAGE_TEMPLATE_FILE.open("r", encoding="utf-8"))
  • writing generated index.html (open(redirect_page_path, "w", encoding="utf-8"))
  • reading redirect_urls.txt (open(REDIRECT_URLS_FILE, "r", encoding="utf-8"))

This is purely a docs-tooling portability fix; no runtime behavior change for UTF-8 environments.

🤖 Generated with WorkBuddy

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs: use explicit UTF-8 encoding in redirect generation script

1 participant