Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

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

share|improve this answer

Python does it natively.

>>> u'あら?'.encode('punycode')
'l8jxh6512d'
>>> print 'p8j2bk2072s'.decode('punycode')
そうだ!
share|improve this answer
    
Very cool example!! and i love python!! +1 –  Arenstar Nov 13 '10 at 18:00
2  
PS: You need to add xn- in front of what python outputs you. GNU has a Punycode library for C/C++ and C# also. –  Quandary Nov 13 '10 at 18:31

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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