Top Description Inners Fields Constructors Methods
com.ibm.icu.text

public abstract Class IDNA

extends Object
Class Inheritance
Known Direct Subclasses
com.ibm.icu.impl.UTS46
Imports
java.util.Collections, .EnumSet, .Set, com.ibm.icu.impl.IDNA2003, .UTS46

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).

Author
Ram Viswanadha, Markus Scherer
ICU Status
Stable since ICU 2.8.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum
IDNA.Error

IDNA error bit set values.

public static class
IDNA.Info

Output container for IDNA processing errors.

Field Summary

Modifier and TypeField and Description
public static final int
ALLOW_UNASSIGNED

Option to allow unassigned code points in domain names and labels.

public static final int
CHECK_BIDI

IDNA option to check for whether the input conforms to the BiDi rules.

public static final int
CHECK_CONTEXTJ

IDNA option to check for whether the input conforms to the CONTEXTJ rules.

public static final int
CHECK_CONTEXTO

IDNA option to check for whether the input conforms to the CONTEXTO rules.

public static final int
DEFAULT

Default options value: None of the other options are set.

public static final int
NONTRANSITIONAL_TO_ASCII

IDNA option for nontransitional processing in ToASCII().

public static final int
NONTRANSITIONAL_TO_UNICODE

IDNA option for nontransitional processing in ToUnicode().

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).

Constructor Summary

AccessConstructor and Description
protected
IDNA()

Deprecated This API is ICU internal only.
Sole constructor.

Method Summary

Modifier and TypeMethod and Description
protected static void
addError(IDNA.Info info, IDNA.Error error)

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

Deprecated This API is ICU internal only.
public static int

Returns:

0 if the strings are equal, > 0 if s1 > s2 and < 0 if s1 < s2
compare
(StringBuffer
First IDN string as StringBuffer
s1
,
StringBuffer
Second IDN string as StringBuffer
s2
,
int
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
options
)

Deprecated ICU 55 Use UTS 46 instead via getUTS46Instance(int).
IDNA2003: Compare two IDN strings for equivalence.
public static int

Returns:

0 if the strings are equal, > 0 if s1 > s2 and < 0 if s1 < s2
compare
(String
First IDN string
s1
,
String
Second IDN string
s2
,
int
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
options
)

Deprecated ICU 55 Use UTS 46 instead via getUTS46Instance(int).
IDNA2003: Compare two IDN strings for equivalence.
public static int

Returns:

0 if the strings are equal, > 0 if i1 > i2 and < 0 if i1 < i2
compare
(UCharacterIterator
First IDN string as UCharacterIterator
s1
,
UCharacterIterator
Second IDN string as UCharacterIterator
s2
,
int
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
options
)

Deprecated ICU 55 Use UTS 46 instead via getUTS46Instance(int).
IDNA2003: Compare two IDN strings for equivalence.
public static StringBuffer

Returns:

StringBuffer the converted String
convertIDNToASCII
(UCharacterIterator
The input string as UCharacterIterator to be processed
src
,
int
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
options
)

Deprecated ICU 55 Use UTS 46 instead via getUTS46Instance(int).
IDNA2003: Convenience function that implements the IDNToASCII operation as defined in the IDNA RFC.
public static StringBuffer

Returns:

StringBuffer the converted String
convertIDNToASCII
(StringBuffer
The input string as a StringBuffer to be processed
src
,
int
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
options
)

Deprecated ICU 55 Use UTS 46 instead via getUTS46Instance(int).
IDNA2003: Convenience function that implements the IDNToASCII operation as defined in the IDNA RFC.
public static StringBuffer

Returns:

StringBuffer the converted String
convertIDNToASCII
(String
The input string to be processed
src
,
int
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
options
)

Deprecated ICU 55 Use UTS 46 instead via getUTS46Instance(int).
IDNA2003: Convenience function that implements the IDNToASCII operation as defined in the IDNA RFC.
public static StringBuffer

Returns:

StringBuffer the converted String
convertIDNToUnicode
(UCharacterIterator
The input string as UCharacterIterator to be processed
src
,
int
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
options
)

Deprecated ICU 55 Use UTS 46 instead via getUTS46Instance(int).
IDNA2003: Convenience function that implements the IDNToUnicode operation as defined in the IDNA RFC.
public static StringBuffer

Returns:

StringBuffer the converted String
convertIDNToUnicode
(StringBuffer
The input string as StringBuffer to be processed
src
,
int
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
options
)

Deprecated ICU 55 Use UTS 46 instead via getUTS46Instance(int).
IDNA2003: Convenience function that implements the IDNToUnicode operation as defined in the IDNA RFC.
public static StringBuffer

Returns:

StringBuffer the converted String
convertIDNToUnicode
(String
The input string to be processed
src
,
int
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
options
)

Deprecated ICU 55 Use UTS 46 instead via getUTS46Instance(int).
IDNA2003: Convenience function that implements the IDNToUnicode operation as defined in the IDNA RFC.
public static StringBuffer

Returns:

StringBuffer the converted String
convertToASCII
(String
The input string to be processed
src
,
int
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
options
)

Deprecated ICU 55 Use UTS 46 instead via getUTS46Instance(int).
IDNA2003: This function implements the ToASCII operation as defined in the IDNA RFC.
public static StringBuffer

Returns:

StringBuffer the converted String
convertToASCII
(StringBuffer
The input string as StringBuffer to be processed
src
,
int
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
options
)

Deprecated ICU 55 Use UTS 46 instead via getUTS46Instance(int).
IDNA2003: This function implements the ToASCII operation as defined in the IDNA RFC.
public static StringBuffer

Returns:

StringBuffer the converted String
convertToASCII
(UCharacterIterator
The input string as UCharacterIterator to be processed
src
,
int
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
options
)

Deprecated ICU 55 Use UTS 46 instead via getUTS46Instance(int).
IDNA2003: This function implements the ToASCII operation as defined in the IDNA RFC.
public static StringBuffer

Returns:

StringBuffer the converted String
convertToUnicode
(String
The input string to be processed
src
,
int
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
options
)

Deprecated ICU 55 Use UTS 46 instead via getUTS46Instance(int).
IDNA2003: This function implements the ToUnicode operation as defined in the IDNA RFC.
public static StringBuffer

Returns:

StringBuffer the converted String
convertToUnicode
(StringBuffer
The input string as StringBuffer to be processed
src
,
int
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
options
)

Deprecated ICU 55 Use UTS 46 instead via getUTS46Instance(int).
IDNA2003: This function implements the ToUnicode operation as defined in the IDNA RFC.
public static StringBuffer

Returns:

StringBuffer the converted String
convertToUnicode
(UCharacterIterator
The input string as UCharacterIterator to be processed
src
,
int
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
options
)

Deprecated ICU 55 Use UTS 46 instead via getUTS46Instance(int).
IDNA2003: Function that implements the ToUnicode operation as defined in the IDNA RFC.
public static IDNA

Returns:

the UTS #46 IDNA instance, if successful
getUTS46Instance
(int
Bit set to modify the processing and error checking.
options
)

Returns an IDNA instance which implements UTS #46.

protected static boolean
hasCertainErrors(IDNA.Info info, EnumSet<IDNA.Error> errors)

Deprecated This API is ICU internal only.
protected static boolean
hasCertainLabelErrors(IDNA.Info info, EnumSet<IDNA.Error> errors)

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

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

Deprecated This API is ICU internal only.
public abstract StringBuilder

Returns:

dest
labelToASCII
(CharSequence
Input domain name label
label
,
StringBuilder
Destination string object
dest
,
IDNA.Info
Output container of IDNA processing details.
info
)

Converts a single domain name label into its ASCII form for DNS lookup.

public abstract StringBuilder

Returns:

dest
labelToUnicode
(CharSequence
Input domain name label
label
,
StringBuilder
Destination string object
dest
,
IDNA.Info
Output container of IDNA processing details.
info
)

Converts a single domain name label into its Unicode form for human-readable display.

public abstract StringBuilder

Returns:

dest
nameToASCII
(CharSequence
Input domain name
name
,
StringBuilder
Destination string object
dest
,
IDNA.Info
Output container of IDNA processing details.
info
)

Converts a whole domain name into its ASCII form for DNS lookup.

public abstract StringBuilder

Returns:

dest
nameToUnicode
(CharSequence
Input domain name
name
,
StringBuilder
Destination string object
dest
,
IDNA.Info
Output container of IDNA processing details.
info
)

Converts a whole domain name into its Unicode form for human-readable display.

protected static void
promoteAndResetLabelErrors(IDNA.Info info)

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

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

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

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

Deprecated This API is ICU internal only.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait