Class Idn

java.lang.Object
google.registry.util.Idn

public final class Idn extends Object
A partial API-compatible replacement for IDN that replaces IDNA2003 processing with UTS46 transitional processing, with differences as described in the UTS46 documentation/

This class provides methods to convert internationalized domain names (IDNs) between Unicode and ASCII-only Punycode form. It implements the parts of the API from IDN that we care about, but will return different results as defined by the differences between IDNA2003 and transitional UTS46.

  • Constructor Details

    • Idn

      public Idn()
  • Method Details

    • toASCII

      public static String toASCII(String name)
      Translates a string from Unicode to ASCII Compatible Encoding (ACE), as defined by the ToASCII operation of RFC 3490.

      This method always uses UTS46 transitional processing.

      Parameters:
      name - a domain name, which may include multiple labels separated by dots
      Throws:
      IllegalArgumentException - if the input string doesn't conform to RFC 3490 specification
      See Also:
    • toUnicode

      public static String toUnicode(String name)
      Translates a string from ASCII Compatible Encoding (ACE) to Unicode, as defined by the ToUnicode operation of RFC 3490.

      This method always uses UTS46 transitional processing.

      ToUnicode never fails. In case of any error, the input string is returned unmodified.

      Parameters:
      name - a domain name, which may include multiple labels separated by dots
      See Also: