The freely available open source project International Components for Unicode (ICU) has UTF conversion built into it. The latest version may be downloaded from the ICU Project web site. Many other libraries may have built-in converters, so you may not have to write your own. [AF]
Use Punycode for converting labels that are part of network identifiers into a form compatible with ASCII labels. This method is required as part of IDNA 2008 and earlier for Internationalized Domain Names (IDN). It re-encodes Unicode into a subset of ASCII characters containing only the letters and digits.