-
Notifications
You must be signed in to change notification settings - Fork 0
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
Steps to implementing IDNA/URL in JS #9
Comments
As per @annevk’s http://annevankesteren.nl/2014/06/url-unicode, http://unicode.org/reports/tr46/ should be used. It’s compatible with IDNA2003, but uses IDNA2008 data. |
potentially related work: reference implementation, live demo, updated parser spec |
For what it's worth, I started coding up a UTR#46 implementation in JS. You don't need stringprep/nameprep (you can use http://www.unicode.org/Public/idna/7.0.0/IdnaMappingTable.txt instead, and without detailed Unicode property reflection in JS, you'll have to have a table lookup anyways). Unfortunately, the UTR46 test vectors drove me insane because they don't match the propose as near as I can tell. I did not try to implement the contextual rules, and I gave up on trying to get the bidi rules to match. Since those rules are mostly about what labels are valid and don't otherwise change the mapping, I feel it's okay to ignore them for most JS library purposes. |
They follow a different RFC than the URL spec references, so we'll have to lowercase ourselves first.
FWIW, I just uploaded some code I have to https://github.com/jcranmer/idna-uts46, which implements much of UTS #46 (sans Bidi and contextual because screw them). |
All of the browsers already implement IDN handling, are you sure we shouldn't advocate for exposing this functionality in ES7? I've never actually pushed for a standard before, but the browser vendors really need to be in lockstep with IDN handling anyway.... |
https://url.spec.whatwg.org/#api has some API surface for this, but it's not implemented (yet). |
@annevk Tickets at Kangax and caniuse might increase visibility. |
Go for it. I don't really want to do that having designed the API. Seems better if others advocate for it. |
String.prototype.normalize
polyfill (or useunorm
?)IDNA2003Unicode TR46 as per the URL standardReferences
1
) punycode.js#12The text was updated successfully, but these errors were encountered: