IdnToPunycode allows the developer to convert an internationalized domain name to its punycode representation, and back. For more information see here and here. For technical details see here. As an added bonus it's possible to pass an e-mail address instead of a domain name. In this case, the local part stays unaltered.
Upgrade to Platform 11, no changes in code.