Update IDNA encoding to 2008 spec - #161
Conversation
sethmlarson
left a comment
There was a problem hiding this comment.
Thanks for opening this @StephenBrown2! I've marked a few issues, I think we should look at how urrlib3 handles this case or explore using rfc3986.IRIReference to handle it for us.
|
Looks like rfc3986.IRIReference will in fact do exactly what we want, including handling colons in the authority. I've rebased on master to resolve the conflict with hsts... and switched to using Ref: convenience function - https://github.com/python-hyper/rfc3986/blob/df21c4b09078580c1cb10c728dc18c3111fcf603/src/rfc3986/api.py#L41 |
| ) -> None: | ||
| if isinstance(url, rfc3986.uri.URIReference): | ||
| self.components = url | ||
| elif isinstance(url, rfc3986.iri.IRIReference): |
There was a problem hiding this comment.
I don't think we should be exposing extra types as part of this pull request.
(In fact I don't think we should be exposing rfc3986.uri.URIReference as part of our public interface in the first place - it'd be much better if we could keep that as an internal implementation detail, in order to allow us to completely switch implementations if needed.)
|
I guess we might also choose to switch our dependency listing to That'd stop devs from having to do a "wait where are you actually using the |
sethmlarson
left a comment
There was a problem hiding this comment.
I rebased and removed a test case that's no longer valid due to interface changes.
|
Yas - good stuff! |
Co-authored-by: Josep Cugat <jcugat@gmail.com>
Resolves #150 and adds tests based on deviations from 2003 spec: https://unicode.org/reports/tr46/#Deviations
This also enables Unicode庐 Technical Standard #46 to normalize capital letters and such, and a test based on the example given in the module documentation.
Since the idna encode() function chokes on colons, I've split and rejoined the authority string and added to the tests to make sure the port stays as expected.