IDN
Stay organized with collections
Save and categorize content based on your preferences.
Converts internationalized domain names between Unicode and the ASCII Compatible Encoding
(ACE) representation.
See RFC 3490 for full details.
Public Method Summary
static
String
|
toASCII( String input, int flags)
Transform a Unicode String to ASCII Compatible Encoding String according
to the algorithm defined in RFC 3490.
|
static
String
|
|
static
String
|
toUnicode( String input, int flags)
Translates a string from ASCII Compatible Encoding (ACE) to Unicode
according to the algorithm defined in RFC 3490.
|
static
String
|
|
Inherited Method Summary
From class
java.lang.Object
Object
|
clone()
Creates and returns a copy of this Object .
|
boolean
|
equals( Object obj)
Compares this instance with the specified object and indicates if they
are equal.
|
void
|
finalize()
Invoked when the garbage collector has detected that this instance is no longer reachable.
|
final
Class<?>
|
getClass()
Returns the unique instance of Class that represents this
object's class.
|
int
|
hashCode()
Returns an integer hash code for this object.
|
final
void
|
notify()
Causes a thread which is waiting on this object's monitor (by means of
calling one of the wait() methods) to be woken up.
|
final
void
|
notifyAll()
Causes all threads which are waiting on this object's monitor (by means
of calling one of the wait() methods) to be woken up.
|
String
|
toString()
Returns a string containing a concise, human-readable description of this
object.
|
final
void
|
wait(long timeout, int nanos)
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the
specified timeout expires.
|
final
void
|
wait(long timeout)
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the
specified timeout expires.
|
final
void
|
wait()
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object.
|
Constants
public
static
final
int
ALLOW_UNASSIGNED
When set, allows IDN to process unassigned unicode points.
Constant Value:
1
public
static
final
int
USE_STD3_ASCII_RULES
Public Methods
Transform a Unicode String to ASCII Compatible Encoding String according
to the algorithm defined in RFC 3490.
If the transformation fails (because the input is not a valid IDN), an
exception will be thrown.
This method can handle either an individual label or an entire domain name.
In the latter case, the separators are: U+002E (full stop), U+3002 (ideographic full stop),
U+FF0E (fullwidth full stop), and U+FF61 (halfwidth ideographic full stop).
All of these will become U+002E (full stop) in the result.
Parameters
input |
the Unicode name |
flags |
0, ALLOW_UNASSIGNED , USE_STD3_ASCII_RULES ,
or ALLOW_UNASSIGNED | USE_STD3_ASCII_RULES |
Equivalent to toASCII(input, 0)
.
Translates a string from ASCII Compatible Encoding (ACE) to Unicode
according to the algorithm defined in RFC 3490.
Unlike toASCII
, this transformation cannot fail.
This method can handle either an individual label or an entire domain name.
In the latter case, the separators are: U+002E (full stop), U+3002 (ideographic full stop),
U+FF0E (fullwidth full stop), and U+FF61 (halfwidth ideographic full stop).
Parameters
input |
the ACE name |
flags |
0, ALLOW_UNASSIGNED , USE_STD3_ASCII_RULES ,
or ALLOW_UNASSIGNED | USE_STD3_ASCII_RULES
|
Equivalent to toUnicode(input, 0)
.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-07-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-07-10 UTC."],[[["The `IDN` class converts internationalized domain names (IDNs) between Unicode and ASCII Compatible Encoding (ACE) as defined in RFC 3490."],["It provides methods `toASCII` and `toUnicode` for converting between these formats, handling both individual labels and entire domain names."],["The constants `ALLOW_UNASSIGNED` and `USE_STD3_ASCII_RULES` allow for control over the conversion process."],["An `IllegalArgumentException` is thrown if the input to `toASCII` does not conform to RFC 3490."]]],["The `IDN` class converts internationalized domain names between Unicode and ASCII Compatible Encoding (ACE). It offers four main methods: `toASCII` and `toUnicode`, each in two versions that either take a string and an integer of flags or a string alone. `toASCII` transforms Unicode to ACE, potentially throwing an exception if input is invalid. `toUnicode` converts ACE to Unicode without failing. Both methods process individual labels or entire domain names and follow RFC 3490. Key flags include `ALLOW_UNASSIGNED` and `USE_STD3_ASCII_RULES`.\n"]]