Class IDNA

  • Direct Known Subclasses:
    UTS46

    public abstract class IDNA
    extends java.lang.Object
    Abstract base class for IDNA processing. See http://www.unicode.org/reports/tr46/ and http://www.ietf.org/rfc/rfc3490.txt

    The IDNA class is not intended for public subclassing.

    The non-static methods implement UTS #46 and IDNA2008. IDNA2008 is implemented according to UTS #46, see getUTS46Instance().

    IDNA2003 is obsolete. The static methods implement IDNA2003. They are all deprecated.

    IDNA2003 API Overview:

    The static IDNA API methods implement the IDNA protocol as defined in the IDNA RFC. The draft defines 2 operations: ToASCII and ToUnicode. Domain labels containing non-ASCII code points are required to be processed by ToASCII operation before passing it to resolver libraries. Domain names that are obtained from resolver libraries are required to be processed by ToUnicode operation before displaying the domain name to the user. IDNA requires that implementations process input strings with Nameprep, which is a profile of Stringprep , and then with Punycode. Implementations of IDNA MUST fully implement Nameprep and Punycode; neither Nameprep nor Punycode are optional. The input and output of ToASCII and ToUnicode operations are Unicode and are designed to be chainable, i.e., applying ToASCII or ToUnicode operations multiple times to an input string will yield the same result as applying the operation once. ToUnicode(ToUnicode(ToUnicode...(ToUnicode(string)))) == ToUnicode(string) ToASCII(ToASCII(ToASCII...(ToASCII(string))) == ToASCII(string).

    • Field Detail

      • DEFAULT

        public static final int DEFAULT
        Default options value: None of the other options are set. For use in static worker and factory methods.
        See Also:
        Constant Field Values
      • ALLOW_UNASSIGNED

        @Deprecated
        public static final int ALLOW_UNASSIGNED
        Deprecated.
        ICU 55 Use UTS 46 instead via getUTS46Instance(int).
        Option to allow unassigned code points in domain names and labels. For use in static worker and factory methods.

        This option is ignored by the UTS46 implementation. (UTS #46 disallows unassigned code points.)

        See Also:
        Constant Field Values
      • USE_STD3_RULES

        public static final int USE_STD3_RULES
        Option to check whether the input conforms to the STD3 ASCII rules, for example the restriction of labels to LDH characters (ASCII Letters, Digits and Hyphen-Minus). For use in static worker and factory methods.
        See Also:
        Constant Field Values
      • CHECK_BIDI

        public static final int CHECK_BIDI
        IDNA option to check for whether the input conforms to the BiDi rules. For use in static worker and factory methods.

        This option is ignored by the IDNA2003 implementation. (IDNA2003 always performs a BiDi check.)

        See Also:
        Constant Field Values
      • CHECK_CONTEXTJ

        public static final int CHECK_CONTEXTJ
        IDNA option to check for whether the input conforms to the CONTEXTJ rules. For use in static worker and factory methods.

        This option is ignored by the IDNA2003 implementation. (The CONTEXTJ check is new in IDNA2008.)

        See Also:
        Constant Field Values
      • NONTRANSITIONAL_TO_ASCII

        public static final int NONTRANSITIONAL_TO_ASCII
        IDNA option for nontransitional processing in ToASCII(). For use in static worker and factory methods.

        By default, ToASCII() uses transitional processing.

        This option is ignored by the IDNA2003 implementation. (This is only relevant for compatibility of newer IDNA implementations with IDNA2003.)

        See Also:
        Constant Field Values
      • NONTRANSITIONAL_TO_UNICODE

        public static final int NONTRANSITIONAL_TO_UNICODE
        IDNA option for nontransitional processing in ToUnicode(). For use in static worker and factory methods.

        By default, ToUnicode() uses transitional processing.

        This option is ignored by the IDNA2003 implementation. (This is only relevant for compatibility of newer IDNA implementations with IDNA2003.)

        See Also:
        Constant Field Values
      • CHECK_CONTEXTO

        public static final int CHECK_CONTEXTO
        IDNA option to check for whether the input conforms to the CONTEXTO rules. For use in static worker and factory methods.

        This option is ignored by the IDNA2003 implementation. (The CONTEXTO check is new in IDNA2008.)

        This is for use by registries for IDNA2008 conformance. UTS #46 does not require the CONTEXTO check.

        See Also:
        Constant Field Values
    • Constructor Detail

      • IDNA

        @Deprecated
        protected IDNA()
        Deprecated.
        This API is ICU internal only.
        Sole constructor. (For invocation by subclass constructors, typically implicit.)
    • Method Detail

      • getUTS46Instance

        public static IDNA getUTS46Instance​(int options)
        Returns an IDNA instance which implements UTS #46. Returns an unmodifiable instance, owned by the caller. Cache it for multiple operations, and delete it when done. The instance is thread-safe, that is, it can be used concurrently.

        UTS #46 defines Unicode IDNA Compatibility Processing, updated to the latest version of Unicode and compatible with both IDNA2003 and IDNA2008.

        The worker functions use transitional processing, including deviation mappings, unless NONTRANSITIONAL_TO_ASCII or NONTRANSITIONAL_TO_UNICODE is used in which case the deviation characters are passed through without change.

        Disallowed characters are mapped to U+FFFD.

        Operations with the UTS #46 instance do not support the ALLOW_UNASSIGNED option.

        By default, the UTS #46 implementation allows all ASCII characters (as valid or mapped). When the USE_STD3_RULES option is used, ASCII characters other than letters, digits, hyphen (LDH) and dot/full stop are disallowed and mapped to U+FFFD.

        Parameters:
        options - Bit set to modify the processing and error checking.
        Returns:
        the UTS #46 IDNA instance, if successful
      • labelToASCII

        public abstract java.lang.StringBuilder labelToASCII​(java.lang.CharSequence label,
                                                             java.lang.StringBuilder dest,
                                                             IDNA.Info info)
        Converts a single domain name label into its ASCII form for DNS lookup. If any processing step fails, then info.hasErrors() will be true and the result might not be an ASCII string. The label might be modified according to the types of errors. Labels with severe errors will be left in (or turned into) their Unicode form.
        Parameters:
        label - Input domain name label
        dest - Destination string object
        info - Output container of IDNA processing details.
        Returns:
        dest
      • labelToUnicode

        public abstract java.lang.StringBuilder labelToUnicode​(java.lang.CharSequence label,
                                                               java.lang.StringBuilder dest,
                                                               IDNA.Info info)
        Converts a single domain name label into its Unicode form for human-readable display. If any processing step fails, then info.hasErrors() will be true. The label might be modified according to the types of errors.
        Parameters:
        label - Input domain name label
        dest - Destination string object
        info - Output container of IDNA processing details.
        Returns:
        dest
      • nameToASCII

        public abstract java.lang.StringBuilder nameToASCII​(java.lang.CharSequence name,
                                                            java.lang.StringBuilder dest,
                                                            IDNA.Info info)
        Converts a whole domain name into its ASCII form for DNS lookup. If any processing step fails, then info.hasErrors() will be true and the result might not be an ASCII string. The domain name might be modified according to the types of errors. Labels with severe errors will be left in (or turned into) their Unicode form.
        Parameters:
        name - Input domain name
        dest - Destination string object
        info - Output container of IDNA processing details.
        Returns:
        dest
      • nameToUnicode

        public abstract java.lang.StringBuilder nameToUnicode​(java.lang.CharSequence name,
                                                              java.lang.StringBuilder dest,
                                                              IDNA.Info info)
        Converts a whole domain name into its Unicode form for human-readable display. If any processing step fails, then info.hasErrors() will be true. The domain name might be modified according to the types of errors.
        Parameters:
        name - Input domain name
        dest - Destination string object
        info - Output container of IDNA processing details.
        Returns:
        dest
      • resetInfo

        @Deprecated
        protected static void resetInfo​(IDNA.Info info)
        Deprecated.
        This API is ICU internal only.
      • hasCertainErrors

        @Deprecated
        protected static boolean hasCertainErrors​(IDNA.Info info,
                                                  java.util.EnumSet<IDNA.Error> errors)
        Deprecated.
        This API is ICU internal only.
      • hasCertainLabelErrors

        @Deprecated
        protected static boolean hasCertainLabelErrors​(IDNA.Info info,
                                                       java.util.EnumSet<IDNA.Error> errors)
        Deprecated.
        This API is ICU internal only.
      • addLabelError

        @Deprecated
        protected static void addLabelError​(IDNA.Info info,
                                            IDNA.Error error)
        Deprecated.
        This API is ICU internal only.
      • promoteAndResetLabelErrors

        @Deprecated
        protected static void promoteAndResetLabelErrors​(IDNA.Info info)
        Deprecated.
        This API is ICU internal only.
      • addError

        @Deprecated
        protected static void addError​(IDNA.Info info,
                                       IDNA.Error error)
        Deprecated.
        This API is ICU internal only.
      • setTransitionalDifferent

        @Deprecated
        protected static void setTransitionalDifferent​(IDNA.Info info)
        Deprecated.
        This API is ICU internal only.
      • setBiDi

        @Deprecated
        protected static void setBiDi​(IDNA.Info info)
        Deprecated.
        This API is ICU internal only.
      • isBiDi

        @Deprecated
        protected static boolean isBiDi​(IDNA.Info info)
        Deprecated.
        This API is ICU internal only.
      • setNotOkBiDi

        @Deprecated
        protected static void setNotOkBiDi​(IDNA.Info info)
        Deprecated.
        This API is ICU internal only.
      • isOkBiDi

        @Deprecated
        protected static boolean isOkBiDi​(IDNA.Info info)
        Deprecated.
        This API is ICU internal only.
      • convertToASCII

        @Deprecated
        public static java.lang.StringBuffer convertToASCII​(java.lang.String src,
                                                            int options)
                                                     throws StringPrepParseException
        Deprecated.
        ICU 55 Use UTS 46 instead via getUTS46Instance(int).
        IDNA2003: This function implements the ToASCII operation as defined in the IDNA RFC. This operation is done on single labels before sending it to something that expects ASCII names. A label is an individual part of a domain name. Labels are usually separated by dots; e.g." "www.example.com" is composed of 3 labels "www","example", and "com".
        Parameters:
        src - The input string to be processed
        options - A bit set of options: - IDNA.DEFAULT Use default options, i.e., do not process unassigned code points and do not use STD3 ASCII rules If unassigned code points are found the operation fails with StringPrepParseException. - IDNA.ALLOW_UNASSIGNED Unassigned values can be converted to ASCII for query operations If this option is set, the unassigned code points are in the input are treated as normal Unicode code points. - IDNA.USE_STD3_RULES Use STD3 ASCII rules for host name syntax restrictions If this option is set and the input does not satisfy STD3 rules, the operation will fail with ParseException
        Returns:
        StringBuffer the converted String
        Throws:
        StringPrepParseException - When an error occurs for parsing a string.
      • convertToASCII

        @Deprecated
        public static java.lang.StringBuffer convertToASCII​(java.lang.StringBuffer src,
                                                            int options)
                                                     throws StringPrepParseException
        Deprecated.
        ICU 55 Use UTS 46 instead via getUTS46Instance(int).
        IDNA2003: This function implements the ToASCII operation as defined in the IDNA RFC. This operation is done on single labels before sending it to something that expects ASCII names. A label is an individual part of a domain name. Labels are usually separated by dots; e.g." "www.example.com" is composed of 3 labels "www","example", and "com".
        Parameters:
        src - The input string as StringBuffer to be processed
        options - A bit set of options: - IDNA.DEFAULT Use default options, i.e., do not process unassigned code points and do not use STD3 ASCII rules If unassigned code points are found the operation fails with ParseException. - IDNA.ALLOW_UNASSIGNED Unassigned values can be converted to ASCII for query operations If this option is set, the unassigned code points are in the input are treated as normal Unicode code points. - IDNA.USE_STD3_RULES Use STD3 ASCII rules for host name syntax restrictions If this option is set and the input does not satisfy STD3 rules, the operation will fail with ParseException
        Returns:
        StringBuffer the converted String
        Throws:
        StringPrepParseException
      • convertToASCII

        @Deprecated
        public static java.lang.StringBuffer convertToASCII​(UCharacterIterator src,
                                                            int options)
                                                     throws StringPrepParseException
        Deprecated.
        ICU 55 Use UTS 46 instead via getUTS46Instance(int).
        IDNA2003: This function implements the ToASCII operation as defined in the IDNA RFC. This operation is done on single labels before sending it to something that expects ASCII names. A label is an individual part of a domain name. Labels are usually separated by dots; e.g." "www.example.com" is composed of 3 labels "www","example", and "com".
        Parameters:
        src - The input string as UCharacterIterator to be processed
        options - A bit set of options: - IDNA.DEFAULT Use default options, i.e., do not process unassigned code points and do not use STD3 ASCII rules If unassigned code points are found the operation fails with ParseException. - IDNA.ALLOW_UNASSIGNED Unassigned values can be converted to ASCII for query operations If this option is set, the unassigned code points are in the input are treated as normal Unicode code points. - IDNA.USE_STD3_RULES Use STD3 ASCII rules for host name syntax restrictions If this option is set and the input does not satisfy STD3 rules, the operation will fail with ParseException
        Returns:
        StringBuffer the converted String
        Throws:
        StringPrepParseException
      • convertIDNToASCII

        @Deprecated
        public static java.lang.StringBuffer convertIDNToASCII​(UCharacterIterator src,
                                                               int options)
                                                        throws StringPrepParseException
        Deprecated.
        ICU 55 Use UTS 46 instead via getUTS46Instance(int).
        IDNA2003: Convenience function that implements the IDNToASCII operation as defined in the IDNA RFC. This operation is done on complete domain names, e.g: "www.example.com". It is important to note that this operation can fail. If it fails, then the input domain name cannot be used as an Internationalized Domain Name and the application should have methods defined to deal with the failure. Note: IDNA RFC specifies that a conformant application should divide a domain name into separate labels, decide whether to apply allowUnassigned and useSTD3ASCIIRules on each, and then convert. This function does not offer that level of granularity. The options once set will apply to all labels in the domain name
        Parameters:
        src - The input string as UCharacterIterator to be processed
        options - A bit set of options: - IDNA.DEFAULT Use default options, i.e., do not process unassigned code points and do not use STD3 ASCII rules If unassigned code points are found the operation fails with ParseException. - IDNA.ALLOW_UNASSIGNED Unassigned values can be converted to ASCII for query operations If this option is set, the unassigned code points are in the input are treated as normal Unicode code points. - IDNA.USE_STD3_RULES Use STD3 ASCII rules for host name syntax restrictions If this option is set and the input does not satisfy STD3 rules, the operation will fail with ParseException
        Returns:
        StringBuffer the converted String
        Throws:
        StringPrepParseException
      • convertIDNToASCII

        @Deprecated
        public static java.lang.StringBuffer convertIDNToASCII​(java.lang.StringBuffer src,
                                                               int options)
                                                        throws StringPrepParseException
        Deprecated.
        ICU 55 Use UTS 46 instead via getUTS46Instance(int).
        IDNA2003: Convenience function that implements the IDNToASCII operation as defined in the IDNA RFC. This operation is done on complete domain names, e.g: "www.example.com". It is important to note that this operation can fail. If it fails, then the input domain name cannot be used as an Internationalized Domain Name and the application should have methods defined to deal with the failure. Note: IDNA RFC specifies that a conformant application should divide a domain name into separate labels, decide whether to apply allowUnassigned and useSTD3ASCIIRules on each, and then convert. This function does not offer that level of granularity. The options once set will apply to all labels in the domain name
        Parameters:
        src - The input string as a StringBuffer to be processed
        options - A bit set of options: - IDNA.DEFAULT Use default options, i.e., do not process unassigned code points and do not use STD3 ASCII rules If unassigned code points are found the operation fails with ParseException. - IDNA.ALLOW_UNASSIGNED Unassigned values can be converted to ASCII for query operations If this option is set, the unassigned code points are in the input are treated as normal Unicode code points. - IDNA.USE_STD3_RULES Use STD3 ASCII rules for host name syntax restrictions If this option is set and the input does not satisfy STD3 rules, the operation will fail with ParseException
        Returns:
        StringBuffer the converted String
        Throws:
        StringPrepParseException
      • convertIDNToASCII

        @Deprecated
        public static java.lang.StringBuffer convertIDNToASCII​(java.lang.String src,
                                                               int options)
                                                        throws StringPrepParseException
        Deprecated.
        ICU 55 Use UTS 46 instead via getUTS46Instance(int).
        IDNA2003: Convenience function that implements the IDNToASCII operation as defined in the IDNA RFC. This operation is done on complete domain names, e.g: "www.example.com". It is important to note that this operation can fail. If it fails, then the input domain name cannot be used as an Internationalized Domain Name and the application should have methods defined to deal with the failure. Note: IDNA RFC specifies that a conformant application should divide a domain name into separate labels, decide whether to apply allowUnassigned and useSTD3ASCIIRules on each, and then convert. This function does not offer that level of granularity. The options once set will apply to all labels in the domain name
        Parameters:
        src - The input string to be processed
        options - A bit set of options: - IDNA.DEFAULT Use default options, i.e., do not process unassigned code points and do not use STD3 ASCII rules If unassigned code points are found the operation fails with ParseException. - IDNA.ALLOW_UNASSIGNED Unassigned values can be converted to ASCII for query operations If this option is set, the unassigned code points are in the input are treated as normal Unicode code points. - IDNA.USE_STD3_RULES Use STD3 ASCII rules for host name syntax restrictions If this option is set and the input does not satisfy STD3 rules, the operation will fail with ParseException
        Returns:
        StringBuffer the converted String
        Throws:
        StringPrepParseException
      • convertToUnicode

        @Deprecated
        public static java.lang.StringBuffer convertToUnicode​(java.lang.String src,
                                                              int options)
                                                       throws StringPrepParseException
        Deprecated.
        ICU 55 Use UTS 46 instead via getUTS46Instance(int).
        IDNA2003: This function implements the ToUnicode operation as defined in the IDNA RFC. This operation is done on single labels before sending it to something that expects Unicode names. A label is an individual part of a domain name. Labels are usually separated by dots; for e.g." "www.example.com" is composed of 3 labels "www","example", and "com".
        Parameters:
        src - The input string to be processed
        options - A bit set of options: - IDNA.DEFAULT Use default options, i.e., do not process unassigned code points and do not use STD3 ASCII rules If unassigned code points are found the operation fails with ParseException. - IDNA.ALLOW_UNASSIGNED Unassigned values can be converted to ASCII for query operations If this option is set, the unassigned code points are in the input are treated as normal Unicode code points. - IDNA.USE_STD3_RULES Use STD3 ASCII rules for host name syntax restrictions If this option is set and the input does not satisfy STD3 rules, the operation will fail with ParseException
        Returns:
        StringBuffer the converted String
        Throws:
        StringPrepParseException
      • convertToUnicode

        @Deprecated
        public static java.lang.StringBuffer convertToUnicode​(java.lang.StringBuffer src,
                                                              int options)
                                                       throws StringPrepParseException
        Deprecated.
        ICU 55 Use UTS 46 instead via getUTS46Instance(int).
        IDNA2003: This function implements the ToUnicode operation as defined in the IDNA RFC. This operation is done on single labels before sending it to something that expects Unicode names. A label is an individual part of a domain name. Labels are usually separated by dots; for e.g." "www.example.com" is composed of 3 labels "www","example", and "com".
        Parameters:
        src - The input string as StringBuffer to be processed
        options - A bit set of options: - IDNA.DEFAULT Use default options, i.e., do not process unassigned code points and do not use STD3 ASCII rules If unassigned code points are found the operation fails with ParseException. - IDNA.ALLOW_UNASSIGNED Unassigned values can be converted to ASCII for query operations If this option is set, the unassigned code points are in the input are treated as normal Unicode code points. - IDNA.USE_STD3_RULES Use STD3 ASCII rules for host name syntax restrictions If this option is set and the input does not satisfy STD3 rules, the operation will fail with ParseException
        Returns:
        StringBuffer the converted String
        Throws:
        StringPrepParseException
      • convertToUnicode

        @Deprecated
        public static java.lang.StringBuffer convertToUnicode​(UCharacterIterator src,
                                                              int options)
                                                       throws StringPrepParseException
        Deprecated.
        ICU 55 Use UTS 46 instead via getUTS46Instance(int).
        IDNA2003: Function that implements the ToUnicode operation as defined in the IDNA RFC. This operation is done on single labels before sending it to something that expects Unicode names. A label is an individual part of a domain name. Labels are usually separated by dots; for e.g." "www.example.com" is composed of 3 labels "www","example", and "com".
        Parameters:
        src - The input string as UCharacterIterator to be processed
        options - A bit set of options: - IDNA.DEFAULT Use default options, i.e., do not process unassigned code points and do not use STD3 ASCII rules If unassigned code points are found the operation fails with ParseException. - IDNA.ALLOW_UNASSIGNED Unassigned values can be converted to ASCII for query operations If this option is set, the unassigned code points are in the input are treated as normal Unicode code points. - IDNA.USE_STD3_RULES Use STD3 ASCII rules for host name syntax restrictions If this option is set and the input does not satisfy STD3 rules, the operation will fail with ParseException
        Returns:
        StringBuffer the converted String
        Throws:
        StringPrepParseException
      • convertIDNToUnicode

        @Deprecated
        public static java.lang.StringBuffer convertIDNToUnicode​(UCharacterIterator src,
                                                                 int options)
                                                          throws StringPrepParseException
        Deprecated.
        ICU 55 Use UTS 46 instead via getUTS46Instance(int).
        IDNA2003: Convenience function that implements the IDNToUnicode operation as defined in the IDNA RFC. This operation is done on complete domain names, e.g: "www.example.com". Note: IDNA RFC specifies that a conformant application should divide a domain name into separate labels, decide whether to apply allowUnassigned and useSTD3ASCIIRules on each, and then convert. This function does not offer that level of granularity. The options once set will apply to all labels in the domain name
        Parameters:
        src - The input string as UCharacterIterator to be processed
        options - A bit set of options: - IDNA.DEFAULT Use default options, i.e., do not process unassigned code points and do not use STD3 ASCII rules If unassigned code points are found the operation fails with ParseException. - IDNA.ALLOW_UNASSIGNED Unassigned values can be converted to ASCII for query operations If this option is set, the unassigned code points are in the input are treated as normal Unicode code points. - IDNA.USE_STD3_RULES Use STD3 ASCII rules for host name syntax restrictions If this option is set and the input does not satisfy STD3 rules, the operation will fail with ParseException
        Returns:
        StringBuffer the converted String
        Throws:
        StringPrepParseException
      • convertIDNToUnicode

        @Deprecated
        public static java.lang.StringBuffer convertIDNToUnicode​(java.lang.StringBuffer src,
                                                                 int options)
                                                          throws StringPrepParseException
        Deprecated.
        ICU 55 Use UTS 46 instead via getUTS46Instance(int).
        IDNA2003: Convenience function that implements the IDNToUnicode operation as defined in the IDNA RFC. This operation is done on complete domain names, e.g: "www.example.com". Note: IDNA RFC specifies that a conformant application should divide a domain name into separate labels, decide whether to apply allowUnassigned and useSTD3ASCIIRules on each, and then convert. This function does not offer that level of granularity. The options once set will apply to all labels in the domain name
        Parameters:
        src - The input string as StringBuffer to be processed
        options - A bit set of options: - IDNA.DEFAULT Use default options, i.e., do not process unassigned code points and do not use STD3 ASCII rules If unassigned code points are found the operation fails with ParseException. - IDNA.ALLOW_UNASSIGNED Unassigned values can be converted to ASCII for query operations If this option is set, the unassigned code points are in the input are treated as normal Unicode code points. - IDNA.USE_STD3_RULES Use STD3 ASCII rules for host name syntax restrictions If this option is set and the input does not satisfy STD3 rules, the operation will fail with ParseException
        Returns:
        StringBuffer the converted String
        Throws:
        StringPrepParseException
      • convertIDNToUnicode

        @Deprecated
        public static java.lang.StringBuffer convertIDNToUnicode​(java.lang.String src,
                                                                 int options)
                                                          throws StringPrepParseException
        Deprecated.
        ICU 55 Use UTS 46 instead via getUTS46Instance(int).
        IDNA2003: Convenience function that implements the IDNToUnicode operation as defined in the IDNA RFC. This operation is done on complete domain names, e.g: "www.example.com". Note: IDNA RFC specifies that a conformant application should divide a domain name into separate labels, decide whether to apply allowUnassigned and useSTD3ASCIIRules on each, and then convert. This function does not offer that level of granularity. The options once set will apply to all labels in the domain name
        Parameters:
        src - The input string to be processed
        options - A bit set of options: - IDNA.DEFAULT Use default options, i.e., do not process unassigned code points and do not use STD3 ASCII rules If unassigned code points are found the operation fails with ParseException. - IDNA.ALLOW_UNASSIGNED Unassigned values can be converted to ASCII for query operations If this option is set, the unassigned code points are in the input are treated as normal Unicode code points. - IDNA.USE_STD3_RULES Use STD3 ASCII rules for host name syntax restrictions If this option is set and the input does not satisfy STD3 rules, the operation will fail with ParseException
        Returns:
        StringBuffer the converted String
        Throws:
        StringPrepParseException
      • compare

        @Deprecated
        public static int compare​(java.lang.StringBuffer s1,
                                  java.lang.StringBuffer s2,
                                  int options)
                           throws StringPrepParseException
        Deprecated.
        ICU 55 Use UTS 46 instead via getUTS46Instance(int).
        IDNA2003: Compare two IDN strings for equivalence. This function splits the domain names into labels and compares them. According to IDN RFC, whenever two labels are compared, they are considered equal if and only if their ASCII forms (obtained by applying toASCII) match using an case-insensitive ASCII comparison. Two domain names are considered a match if and only if all labels match regardless of whether label separators match.
        Parameters:
        s1 - First IDN string as StringBuffer
        s2 - Second IDN string as StringBuffer
        options - A bit set of options: - IDNA.DEFAULT Use default options, i.e., do not process unassigned code points and do not use STD3 ASCII rules If unassigned code points are found the operation fails with ParseException. - IDNA.ALLOW_UNASSIGNED Unassigned values can be converted to ASCII for query operations If this option is set, the unassigned code points are in the input are treated as normal Unicode code points. - IDNA.USE_STD3_RULES Use STD3 ASCII rules for host name syntax restrictions If this option is set and the input does not satisfy STD3 rules, the operation will fail with ParseException
        Returns:
        0 if the strings are equal, > 0 if s1 > s2 and < 0 if s1 < s2
        Throws:
        StringPrepParseException
      • compare

        @Deprecated
        public static int compare​(java.lang.String s1,
                                  java.lang.String s2,
                                  int options)
                           throws StringPrepParseException
        Deprecated.
        ICU 55 Use UTS 46 instead via getUTS46Instance(int).
        IDNA2003: Compare two IDN strings for equivalence. This function splits the domain names into labels and compares them. According to IDN RFC, whenever two labels are compared, they are considered equal if and only if their ASCII forms (obtained by applying toASCII) match using an case-insensitive ASCII comparison. Two domain names are considered a match if and only if all labels match regardless of whether label separators match.
        Parameters:
        s1 - First IDN string
        s2 - Second IDN string
        options - A bit set of options: - IDNA.DEFAULT Use default options, i.e., do not process unassigned code points and do not use STD3 ASCII rules If unassigned code points are found the operation fails with ParseException. - IDNA.ALLOW_UNASSIGNED Unassigned values can be converted to ASCII for query operations If this option is set, the unassigned code points are in the input are treated as normal Unicode code points. - IDNA.USE_STD3_RULES Use STD3 ASCII rules for host name syntax restrictions If this option is set and the input does not satisfy STD3 rules, the operation will fail with ParseException
        Returns:
        0 if the strings are equal, > 0 if s1 > s2 and < 0 if s1 < s2
        Throws:
        StringPrepParseException
      • compare

        @Deprecated
        public static int compare​(UCharacterIterator s1,
                                  UCharacterIterator s2,
                                  int options)
                           throws StringPrepParseException
        Deprecated.
        ICU 55 Use UTS 46 instead via getUTS46Instance(int).
        IDNA2003: Compare two IDN strings for equivalence. This function splits the domain names into labels and compares them. According to IDN RFC, whenever two labels are compared, they are considered equal if and only if their ASCII forms (obtained by applying toASCII) match using an case-insensitive ASCII comparison. Two domain names are considered a match if and only if all labels match regardless of whether label separators match.
        Parameters:
        s1 - First IDN string as UCharacterIterator
        s2 - Second IDN string as UCharacterIterator
        options - A bit set of options: - IDNA.DEFAULT Use default options, i.e., do not process unassigned code points and do not use STD3 ASCII rules If unassigned code points are found the operation fails with ParseException. - IDNA.ALLOW_UNASSIGNED Unassigned values can be converted to ASCII for query operations If this option is set, the unassigned code points are in the input are treated as normal Unicode code points. - IDNA.USE_STD3_RULES Use STD3 ASCII rules for host name syntax restrictions If this option is set and the input does not satisfy STD3 rules, the operation will fail with ParseException
        Returns:
        0 if the strings are equal, > 0 if i1 > i2 and < 0 if i1 < i2
        Throws:
        StringPrepParseException