Skip to content
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

Automatically handle punycode encoding and decoding. #18

Closed
amcgregor opened this issue Mar 25, 2021 · 2 comments
Closed

Automatically handle punycode encoding and decoding. #18

amcgregor opened this issue Mar 25, 2021 · 2 comments

Comments

@amcgregor
Copy link
Member

When deserializing a URL provided at instantiation time, or on any assignment of a hostname, punycode encoding should be detected and decoded. When serializing (str(), &c.) the punycode should encoded version of any non-ASCII-safe hostname should be used.

Reference in Marrow Mailer:

@amcgregor
Copy link
Member Author

amcgregor commented Mar 25, 2021

Initial implementation in 9c6fce3. Tested by hand locally, automated tests TBD prior to release.

Screen Shot 2021-04-01 at 10 39 25

@amcgregor
Copy link
Member Author

amcgregor commented Apr 9, 2021

Comprehensive tests added, with a test using Cyrillic encoding borrowed from the url-normalize package also added. There is a point of debate over if the summary compound attribute (typically used for short-form presentation as the text of an anchor) should use the encoded, or Unicode forms.

Ref: https://github.com/marrow/uri/blob/develop/test/test_url_normalize.py#L53

I'd vote in favor of using the readable form for this, but the encoded form for other compound forms, due to the intended purpose/use of this particular attribute for presentation to end-users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant