ruby idna.toUnicode 的乐趣在于,它不会转换 tld 部分中的 punycode
我使用 Idna.toAscii 函数来转换网站名称 www.中国.中国(顶级域名也有 unicode 字符)。
结果是 www.xn--fiqs8s.xn--fiqs8s
我使用 Idna.toUnicode fun 将上面的 punycode 转换回 unicode 字符。
但我只得到www.中国.xn--fiqs8s toUnicode 的乐趣在于忽略 tld 部分。
有什么办法可以克服这个吗?
i use the Idna.toAscii fun to convert a site name www.中国.中国(the tld is also has unicode chars).
the result was www.xn--fiqs8s.xn--fiqs8s
I used the Idna.toUnicode fun to convert the above punycode back to the unicode characters.
but i got only www.中国.xn--fiqs8s
The toUnicode fun is ignoring the tld part.
Is there any way to over come this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
IDN::Idna.toUnicode("www.xn--fiqs8s.xn--fiqs8s")
为我生成“www.中国.中国”。我有 0.0.2 版的 ruby idn gem 和 1.19 版的 LibIDN,您是否需要更新其中之一?
IDN::Idna.toUnicode("www.xn--fiqs8s.xn--fiqs8s")
produces "www.中国.中国" for me.I have version 0.0.2 of the ruby idn gem and version 1.19 of LibIDN, do you perhaps need to update one of these?