Skip to content

fix: add explicit utf-8 encoding to text-mode open() calls - #8311

Open
ZhengQiangZhang (LeonZhang778) wants to merge 1 commit into
microsoft:mainfrom
LeonZhang778:fix/encoding-utf8-open-calls
Open

ZhengQiangZhang (LeonZhang778) wants to merge 1 commit into
microsoft:mainfrom
LeonZhang778:fix/encoding-utf8-open-calls

Conversation

@LeonZhang778

Copy link
Copy Markdown

Fixes #5566

On non-ASCII / non-English locales (e.g. Windows cp950), text-mode open() calls without an explicit encoding raise UnicodeDecodeError when the file contains non-ASCII bytes. The reported playwright_controller.py case was already fixed; this change addresses the remaining similar open() calls across the Python packages by passing encoding="utf-8".

Why are these changes needed?

Related issue number

Checks

Fixes microsoft#5566

On non-ASCII / non-English locales (e.g. Windows cp950), text-mode open()
calls without an explicit encoding raise UnicodeDecodeError when the file
contains non-ASCII bytes. The reported playwright_controller.py case was
already fixed; this change addresses the remaining similar open() calls
across the Python packages by passing encoding="utf-8".
@LeonZhang778

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

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.

open needs encoding='utf-8' for non-english environment, error in playwright_controller.py

1 participant