开发者

ruby toUnicode fun does not return the idn site when there is no www. in the url

In my rails app, i convert a idn url to punycode and back to idn.

开发者_StackOverflowBut if i have a url like this http://日本語.jp (without www.)

domain = "http://日本語.jp"
punycode = Idna.toAscii(domain)  => http://xn--blagzdfd.com

but trying to convert it backto IDN fails

 idn = Idna.toUnicode(punycode) =>        xn--blagzdfd.com instead of http://日本語.jp

the toUnicode converts back properly if we just add www. to the above idn url like http://www.日本語.jp

am i missing something??


finally figured it out. the problem was the http part in the url. the toUnicode fun works fine. if we remove the http part in the url and pass it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜