public abstract class IDNA extends Object
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).
| Modifier and Type | Class and Description |
|---|---|
static class |
IDNA.Error
IDNA error bit set values.
|
static class |
IDNA.Info
Output container for IDNA processing errors.
|
| Modifier and Type | Field and Description |
|---|---|
static int |
CHECK_BIDI
IDNA option to check for whether the input conforms to the BiDi rules.
|
static int |
CHECK_CONTEXTJ
IDNA option to check for whether the input conforms to the CONTEXTJ rules.
|
static int |
CHECK_CONTEXTO
IDNA option to check for whether the input conforms to the CONTEXTO rules.
|
static int |
DEFAULT
Default options value: None of the other options are set.
|
static int |
NONTRANSITIONAL_TO_ASCII
IDNA option for nontransitional processing in ToASCII().
|
static int |
NONTRANSITIONAL_TO_UNICODE
IDNA option for nontransitional processing in ToUnicode().
|
static 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).
|
| Modifier and Type | Method and Description |
|---|---|
static IDNA |
getUTS46Instance(int options)
Returns an IDNA instance which implements UTS #46.
|
abstract StringBuilder |
labelToASCII(CharSequence label,
StringBuilder dest,
IDNA.Info info)
Converts a single domain name label into its ASCII form for DNS lookup.
|
abstract StringBuilder |
labelToUnicode(CharSequence label,
StringBuilder dest,
IDNA.Info info)
Converts a single domain name label into its Unicode form for human-readable display.
|
abstract StringBuilder |
nameToASCII(CharSequence name,
StringBuilder dest,
IDNA.Info info)
Converts a whole domain name into its ASCII form for DNS lookup.
|
abstract StringBuilder |
nameToUnicode(CharSequence name,
StringBuilder dest,
IDNA.Info info)
Converts a whole domain name into its Unicode form for human-readable display.
|
public static final int DEFAULT
public static final int USE_STD3_RULES
public static final int CHECK_BIDI
This option is ignored by the IDNA2003 implementation. (IDNA2003 always performs a BiDi check.)
public static final int CHECK_CONTEXTJ
This option is ignored by the IDNA2003 implementation. (The CONTEXTJ check is new in IDNA2008.)
public static final int NONTRANSITIONAL_TO_ASCII
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.)
public static final int NONTRANSITIONAL_TO_UNICODE
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.)
public static final int CHECK_CONTEXTO
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.
public static IDNA getUTS46Instance(int options)
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.
options - Bit set to modify the processing and error checking.public abstract StringBuilder labelToASCII(CharSequence label, StringBuilder dest, IDNA.Info info)
label - Input domain name labeldest - Destination string objectinfo - Output container of IDNA processing details.public abstract StringBuilder labelToUnicode(CharSequence label, StringBuilder dest, IDNA.Info info)
label - Input domain name labeldest - Destination string objectinfo - Output container of IDNA processing details.public abstract StringBuilder nameToASCII(CharSequence name, StringBuilder dest, IDNA.Info info)
name - Input domain namedest - Destination string objectinfo - Output container of IDNA processing details.public abstract StringBuilder nameToUnicode(CharSequence name, StringBuilder dest, IDNA.Info info)
name - Input domain namedest - Destination string objectinfo - Output container of IDNA processing details.