com.vgrs.xcode.idna
Class Punycode

java.lang.Object
  extended by com.vgrs.xcode.idna.Ace
      extended by 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

Field Summary
static java.lang.String DEFAULT_PREFIX
           
 
Fields inherited from class com.vgrs.xcode.idna.Ace
DEFAULT_USE_STD_3_ASCII_RULES
 
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 com.vgrs.xcode.idna.Ace
decode, domainDecode, domainEncode, encode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_PREFIX

public static final java.lang.String DEFAULT_PREFIX
See Also:
Constant Field Values
Constructor Detail

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 Punycode
aUseStd3AsciiRules - A flag indicating whether the validation algorithm will use the STD 3 ASCII Rules.
Method Detail

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