0

I want to convert a few Unicode words to an International Domain Name, (and back) but can't find a script or other resource to do it on a Windows PC.

Does anyone have such a tool?

HopelessN00b
  • 54,273

2 Answers2

6

instead of punycode as @ignacio-vazquez-abrams said, much better using 'idna' which will give you a better translation (it includes 'xn--' code) that would be:

>>>> u'español'.encode('idna')
'xn--espaol-zwa'

P.S.: wanted to comment on his response, but I couldn't :S

Willyfrog
  • 161
2

Python does it natively.

>>> u'あら?'.encode('punycode')
'l8jxh6512d'
>>> print 'p8j2bk2072s'.decode('punycode')
そうだ!