-1

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

But 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??

1 Answer 1

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.