mathiasbynens / todo

1 stars 0 forks source link

Steps to implementing IDNA/URL in JS #9

Open mathiasbynens opened 10 years ago

mathiasbynens commented 10 years ago
mathiasbynens commented 10 years ago

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.

rubys commented 9 years ago

potentially related work: reference implementation, live demo, updated parser spec

jcranmer commented 9 years ago

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.

jcranmer commented 8 years ago

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).

indolering commented 8 years ago

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....

annevk commented 8 years ago

https://url.spec.whatwg.org/#api has some API surface for this, but it's not implemented (yet).

indolering commented 8 years ago

@annevk Tickets at Kangax and caniuse might increase visibility.

annevk commented 8 years ago

Go for it. I don't really want to do that having designed the API. Seems better if others advocate for it.