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,385
  • 32
  • 133
  • 208
makerofthings7
  • 8,821
  • 28
  • 115
  • 196

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,019
  • 5
  • 78
  • 84