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
  • 53,795
  • 33
  • 135
  • 209
makerofthings7
  • 8,911
  • 34
  • 121
  • 197

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
  • 1
  • 2
2

Python does it natively.

>>> u'あら?'.encode('punycode')
'l8jxh6512d'
>>> print 'p8j2bk2072s'.decode('punycode')
そうだ!
Ignacio Vazquez-Abrams
  • 45,939
  • 6
  • 79
  • 84