-
-
Notifications
You must be signed in to change notification settings - Fork 30.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GH-85168: Use filesystem encoding when converting to/from file
URIs
#126852
base: main
Are you sure you want to change the base?
Conversation
…` URIs Adjust `urllib.request.url2pathname()` and `pathname2url()` to use the filesystem encoding when quoting and unquoting file URIs, rather than forcing use of UTF-8. No changes are needed in the `nturl2path` module because Windows always uses UTF-8, per PEP 529.
The freedesktop file URI spec is a useful reference here:
Also:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM in general. But we should support URIs containing not quoted non-ASCII characters.
Thanks for the review - I've made the changes you suggested |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
You can also use fsdecode(TESTFN_UNDECODABLE)
and TESTFN_UNENCODABLE
in some tests if you wish.
Adjust
urllib.request.url2pathname()
andpathname2url()
to use the filesystem encoding when quoting and unquoting file URIs, rather than forcing use of UTF-8.No changes are needed in the
nturl2path
module because Windows always uses UTF-8, per PEP 529.