Common Lisp Package: IDNA

README:

IDNA - International Domain Name functions for Common Lisp.

Usage (unicode -> punycode only at the moment):

Loading:

    (asdf:load-system :idna) 

Encoding strings as IDNA:

    (idna:to-ascii "中央大学.tw")  
    ;; => "xn--fiq80yua78t.tw"  
 
    (idna:to-ascii "müller.example.com")  
    ;; => "xn--mller-kva.example.com" 

Decoding strings from IDNA notation to unicode text:

    (idna:to-unicode "xn--fiq80yua78t.tw")  
    ;; => "中央大学.tw" 

Known bugs

The functions punycode-encode accept a :preserve-case keyword argument that currently doesn't work: punycode-encode returns wrong results, and punycode-decode doesn't implement it at all.

FUNCTION

Public

PUNYCODE-ENCODE (STRING &KEY PRESERVE-CASE)

Encode STRING with the punycode algorithm documented in RFC3492. When PRESERVE-CASE is true, emit case annotations and do not perform case folding (to downcase), as required for ToASCII.

TO-ASCII (STRING)

Encode string to IDNA punycode format using the ToASCII algorithm.

TO-UNICODE (STRING)

Encode string from IDNA punycode format using the ToUnicode algorithm.

Undocumented

PUNYCODE-DECODE (INPUT &KEY PRESERVE-CASE)

Private

Undocumented

ADAPT (DELTA NUMPOINTS FIRST-TIME)

DECODE-DIGIT (CP)

ENCODE-BASIC (C FLAG)

ENCODE-DIGIT (D FLAG)

CONSTANT

Private

Undocumented

+BASE+

+DAMP+

+DELIMITER+

+INITIAL-BIAS+

+INITIAL-N+

+MAXINT+

+SKEW+

+TMAX+

+TMIN+