Peter's answer gives you the official IDN features in PHP 5.2, and if possible, this is the best answer.
However, some users will not be able to install the PECL library in their PHP system, so they will need a conversion library written in plain PHP that they can simply include in their own code.
Fortunately, there is a solution: http://phlymail.com/en/downloads/idna/
This is a PHP class that allows you to encode and decode between unicode and punycode. Very easy to use and does not require any installation (other than downloading and incorporating into your own PHP code).
Obviously, you do not need this if you are using PHP 5.3 or better, or if you can install the PECL library in PHP 5.2, but if you cannot do this, this is a good alternative.
source share