Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What is the easiest way to convert an IDN (such as президент.рф) to Punicode in bash?

share|improve this question
up vote 5 down vote accepted

Take a look at the idn:

[U] net-dns/libidn
     Available versions:  1.22 (~)1.22-r1 {doc elibc_FreeBSD emacs java mono nls static-libs}
     Installed versions:  1.22(03:12:19 PM 07/04/2011)(nls static-libs -doc -elibc_FreeBSD -emacs -java -mono)
     Description:         Internationalized Domain Names (IDN) implementation

For e.g:

$ echo "президент.рф" | idn
share|improve this answer

Assuming you have python on your system, python -c 'import sys;print sys.argv[1].decode("utf-8").encode("idna")' "президент.рф" would do the trick.

share|improve this answer

Your Answer


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.