Library punycode

Library methods for handling punycode strings.

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.

Advantages of Bootstring algorithm are Completeness, Uniqueness, Reversibility, Efficient encoding, Simplicity and Readability.

Portions of this library were adapted from punycode.js by Mathias Bynens under the MIT License.

References:

Author:

  • Rewanth Cool

Copyright © Same as Nmap--See https://nmap.org/book/man-legal.html

Source: https://svn.nmap.org/nmap/nselib/punycode.lua

Functions

decode_label (s)

Decodes a punycode-encoded label to Unicode.

Functions

decode_label (s)

Decodes a punycode-encoded label to Unicode.

If the label starts with "xn--", it will be punycode-decoded. Otherwise, it will be decoded as UTF-8 (ASCII). The return value is always a table of Unicode code points.

Parameters

s
String of input.

Return value:

A table of Unicode code points.