karan / chrome-url-alias

Chrome extension to set URL aliases ("m/" goes to "mail.google.com" etc)
http://bit.ly/url-alias
Apache License 2.0
112 stars 27 forks source link

Added support for non-Latin aliases. #6

Closed Norrius closed 5 years ago

Norrius commented 8 years ago

As of now, if I try to add a non-Latin alias, it doesn't work. For example, I occasionally type github.com using the wrong keyboard layout, which results in something like “пше” (and Google autocompletes it to “пшенная каша”, which is millet porridge in my language, instead of Github). I wanted to use your extension to add an alias “пше” -> “github.com”... alas, it doesn't work.

Thanks to IDN, we have a standard for non-Latin domain name conversion. While I typed a Cyrillic word into the Omnibox, Chrome implicitly converts it to Punycode when I hit enter. This means that the extension tries to match пше against xn--e1at1a (which is the punycode representation).

The solution is to add Punycode conversion when we check the URL: either encode the aliases or decode the URL. I got the Punycode converter from this answer on StackOverflow.

karan commented 8 years ago

Can you trim the new dependency to only have the ToASCII function since that's all we use?

Norrius commented 8 years ago

Done. Should I as well minify the converter?