Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upIDNA support #119
IDNA support #119
Conversation
| # except according to those terms. | ||
|
|
||
|
|
||
| # Run as: python make_idna_table.py idna_table.txt > src/idna_table.rs |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| use std::char; | ||
|
|
||
| fn idna_mapped(mapping: &'static [u32]) -> Result<String, &'static str> { | ||
| let mut ret = "".to_string(); |
This comment has been minimized.
This comment has been minimized.
| if !domain.is_ascii() { | ||
| Err(ParseError::NonAsciiDomainsNotSupportedYet) | ||
| } else if domain.find(&[ | ||
| domain = match punycode::encode_str(&domain) { |
This comment has been minimized.
This comment has been minimized.
SimonSapin
Jul 30, 2015
Member
Converting to punycode should be part of domain_to_ascii per http://www.unicode.org/reports/tr46/#ToASCII , and should happen on individual dot-separated labels, not the entire domain.
| Err(ParseError::NonAsciiDomainsNotSupportedYet) | ||
| } else if domain.find(&[ | ||
| domain = match punycode::encode_str(&domain) { | ||
| Some(dom) => "xn--".to_string() + &dom, |
This comment has been minimized.
This comment has been minimized.
SimonSapin
Jul 30, 2015
Member
I think that adding the xn-- prefix should also be part of domain_to_ascii, but UTS#46 has a bug: whatwg/url#53
|
Could you also integrate the tests form http://www.unicode.org/Public/idna/latest/IdnaTest.txt ? I’m considering rewriting the Python scripts to Rust and running them as Cargo build scripts to avoid having generated files in the repository. However in Gecko it’s not as easy if you’re not using Cargo. It would be a separate How painful is it to do in Gecko? If it would make your like more difficult I can stick to Python and generated files in the repository. |
|
It would be a bit harder to have the Gecko build system run the rust files at build time, but at the moment that's not a blocker. We can include the the generated rust-generated files just as we do with the python generated ones at the moment. |
|
|
|
|
|
See #152 |
|
I've implemented the BIDI checks, and now all of the tests pass (except the contextJ tests, which client software isn't required to pass). |
|
Other than a few nits I think this is ready to land. Thanks again! |
|
@bors-servo r+ |
|
Not sure what’s happening with homu, but the Travis build for the PR push is green. |
valenting commentedJul 29, 2015
I wrote a UTS 46 implementation based on http://intertwingly.net/projects/pegurl/idna.js
It needs a fast path for ascii codepoints, but I wanted to get some feedback on it first.