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

Example with idna-encoded string does not work #8

Open
TAKeanice opened this issue Nov 1, 2020 · 0 comments
Open

Example with idna-encoded string does not work #8

TAKeanice opened this issue Nov 1, 2020 · 0 comments

Comments

@TAKeanice
Copy link

Thanks for this library. I am using it as SPM dependency and recognized the following bug:

The PunycodeSwift library returns "http://www.ラーメン.寿司.co.jp".idnaEncoded! as xn--http://www-.xn--4dkp5a8a.xn--sprr0q.co.jp and "https://test.com".idnaEncoded! as xn--https://test-.com

I am posting this here, because clearly the PunycodeSwift is just doing its job here, but TLDExtractSwift has this as example in its readme.

Possible solutions:

  • remove example
  • provide a way to apply idna encoding only to parts that are not the protocol or other parts of URLs that should not be encoded. For that, TLDExtractSwift only needs one extra method calling into PunycodeSwift, transforming the individual url components.
  • save the protocol definition at the beginning of the url string, so the user can apply Punycode to the individual parts and then re-assemble the URL himself
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

No branches or pull requests

1 participant