Class IDNA


  • public class IDNA
    extends java.lang.Object
    This class offers static methods for converting internationalized domain names to ACE and back.
    • RFC3490 IDNA
    Note that this implementation only supports 16-bit Unicode code points.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String ACE_PREFIX  
    • Constructor Summary

      Constructors 
      Constructor Description
      IDNA()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String toASCII​(java.lang.String input)
      Converts a Unicode string to ASCII using the procedure in RFC3490 section 4.1.
      static java.lang.String toASCII​(java.lang.String input, boolean allowUnassigned, boolean useSTD3ASCIIRules)
      Converts a Unicode string to ASCII using the procedure in RFC3490 section 4.1.
      static java.lang.String toUnicode​(java.lang.String input)
      Converts an ASCII-encoded string to Unicode.
      static java.lang.String toUnicode​(java.lang.String input, boolean allowUnassigned, boolean useSTD3ASCIIRules)
      Converts an ASCII-encoded string to Unicode.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • IDNA

        public IDNA()
    • Method Detail

      • toASCII

        public static java.lang.String toASCII​(java.lang.String input)
                                        throws IDNAException
        Converts a Unicode string to ASCII using the procedure in RFC3490 section 4.1. Unassigned characters are not allowed and STD3 ASCII rules are enforced. The input string may be a domain name containing dots.
        Parameters:
        input - Unicode string.
        Returns:
        Encoded string.
        Throws:
        IDNAException
      • toASCII

        public static java.lang.String toASCII​(java.lang.String input,
                                               boolean allowUnassigned,
                                               boolean useSTD3ASCIIRules)
                                        throws IDNAException
        Converts a Unicode string to ASCII using the procedure in RFC3490 section 4.1. Unassigned characters are not allowed and STD3 ASCII rules are enforced.
        Parameters:
        input - Unicode string.
        allowUnassigned - Unassigned characters, allowed or not?
        useSTD3ASCIIRules - STD3 ASCII rules, enforced or not?
        Returns:
        Encoded string.
        Throws:
        IDNAException
      • toUnicode

        public static java.lang.String toUnicode​(java.lang.String input)
        Converts an ASCII-encoded string to Unicode. Unassigned characters are not allowed and STD3 hostnames are enforced. Input may be domain name containing dots.
        Parameters:
        input - ASCII input string.
        Returns:
        Unicode string.
      • toUnicode

        public static java.lang.String toUnicode​(java.lang.String input,
                                                 boolean allowUnassigned,
                                                 boolean useSTD3ASCIIRules)
        Converts an ASCII-encoded string to Unicode.
        Parameters:
        input - ASCII input string.
        allowUnassigned - Allow unassigned Unicode characters.
        useSTD3ASCIIRules - Check that the output conforms to STD3.
        Returns:
        Unicode string.