Skip to content

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

Open
TINGyu123644 wants to merge 1 commit into
microsoft:mainfrom
TINGyu123644:fix-redirects-utf8-7749
Open

TINGyu123644 wants to merge 1 commit into
microsoft:mainfrom
TINGyu123644:fix-redirects-utf8-7749

Conversation

@TINGyu123644

Copy link
Copy Markdown

Why are these changes needed?

python/docs/redirects/redirects.py reads the redirect template, writes the generated redirect index.html pages, and reads the redirect URL list without specifying an explicit encoding. On Windows locales where Python's default encoding is not UTF-8, this can raise UnicodeDecodeError / UnicodeEncodeError when those files contain non-ASCII characters. Fixes #7749.

This is an AI-assisted documentation-tooling fix.

Related issue number

Fixes #7749

Checks

  • Doc changes included (this script generates the documentation redirect pages).
  • Tests added — not applicable; the script has no test suite and the change only adds encoding="utf-8" to three open() calls.
  • Verified with python -m py_compile that the edited script still compiles.

Behavior is unchanged for ASCII content and is now safe for non-ASCII files on systems whose default encoding is not UTF-8.

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