Feature Request: IDNA support #3045

Closed
takaomag opened this Issue Jul 3, 2015 · 6 comments

Projects

None yet

4 participants

@takaomag
Contributor
takaomag commented Jul 3, 2015

To encode, decode and check Internationalized Domain Name, it would be nice if stdlib has IDNA(Stringprep/Punycode) library like golang.org/x/net/idna and Python encodings.idna.
Wrapping libidn may be one suitable choice on Linux.

@Varriount
Contributor

If this is to be in the standard library, it's really preferable that it be implemented in pure Nim, so that additional dependencies aren't added.

@apense
Contributor
apense commented Jul 3, 2015

Here's a gist that does the encoding: https://gist.github.com/apense/a2e7fbddfbd0f3561b82
I just translated it from the Go punycode.go file that you linked to. Seems to work, but it's not great style. Do with it what you will.

@apense
Contributor
apense commented Jul 3, 2015

Updated the gist. It's based of off of Libidn (both the C# and Java implementations). Tried to document what's happening It can be made a lot cleaner, but it works. Personally, I think it's not good enough for stdlib (yet, at least)

@apense
Contributor
apense commented Jul 3, 2015

@BigBoneDaddy well the Punycode algorithm is based off an RFC, so it should be public license. I can rename some of the functions. Really, it's a bit different because Nim differentiates between len() and runelen() EDIT: different from the other implementations. I just used them as a guideline and did Nim very quickly. I'm certain there are some optimizations to be made and dirty code to be cleaned

@Araq Araq added a commit that closed this issue Jun 15, 2016
@Araq Araq fixes #3045 9950bc3
@Araq Araq closed this in 9950bc3 Jun 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment