com.vgrs.xcode.idna
Class Punycode
java.lang.Object
com.vgrs.xcode.idna.Ace
com.vgrs.xcode.idna.Punycode
public final class Punycode
- extends Ace
This class implements the ASCII-Compatible Encoding (ACE) algorithm Punycode:
A Bootstring encoding of Unicode for Internationalized Domain Names in
Applications (IDNA). Reference: RFC 3492 Punycode is a simple and efficient
transfer encoding syntax designed for use with Internationalized Domain Names
in Applications (IDNA). It uniquely and reversibly transforms a Unicode
string into an ASCII string. ASCII characters in the Unicode string are
represented literally, and non-ASCII characters are represented by ASCII
characters that are allowed in host name labels (letters, digits, and
hyphens). This document defines a general algorithm called Bootstring that
allows a string of basic code points to uniquely represent any string of code
points drawn from a larger set. Punycode is an instance of Bootstring that
uses particular parameter values specified by this document, appropriate for
IDNA. The code below is almost a direct port of the sample implementation in
C provided by the author in RFC 3492. NOTE: Punycode makes no effort to
convert valid surrogate pairs into an appropriate codepoint outside the BMP.
This is by design. However, the implication is that these data can result in
different encoded sequences, despite the notion that in some context they are
identical.
- Version:
- 1.0 Aug 3, 2010
- Author:
- nchigurupati
|
Constructor Summary |
Punycode()
Construct Punycode with default values. |
Punycode(boolean aUseStd3AsciiRules)
|
Punycode(java.lang.String aPrefix)
|
Punycode(java.lang.String aPrefix,
boolean aUseStd3AsciiRules)
|
|
Method Summary |
protected int[] |
internalDecode(char[] input)
Ace specific decoding to be performed on the given input. |
protected char[] |
internalEncode(int[] aInput)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DEFAULT_PREFIX
public static final java.lang.String DEFAULT_PREFIX
- See Also:
- Constant Field Values
Punycode
public Punycode()
- Construct Punycode with default values.
Punycode
public Punycode(java.lang.String aPrefix)
- Parameters:
aPrefix - the prefix for Punycode
Punycode
public Punycode(boolean aUseStd3AsciiRules)
- Parameters:
aUseStd3AsciiRules - A flag indicating whether the validation algorithm will use the STD
3 ASCII Rules.
Punycode
public Punycode(java.lang.String aPrefix,
boolean aUseStd3AsciiRules)
- Parameters:
aPrefix - the prefix for PunycodeaUseStd3AsciiRules - A flag indicating whether the validation algorithm will use the STD
3 ASCII Rules.
internalEncode
protected char[] internalEncode(int[] aInput)
throws XcodeException
- Specified by:
internalEncode in class Ace
- Throws:
XcodeException
internalDecode
protected int[] internalDecode(char[] input)
throws XcodeException
- Description copied from class:
Ace
- Ace specific decoding to be performed on the given input.
- Specified by:
internalDecode in class Ace
- Parameters:
input - a UTF16 character array to be decoded into Unicode code points.
- Returns:
- decoded Unicode code points
- Throws:
XcodeException
Copyright © 2000-2010 VeriSign Inc. All Rights Reserved