module SimpleIdn::Punycode

Defined in:

simple_idn.cr

Constant Summary

BASE = 36
DAMP = 700
DELIMITER = 45_u8
INITIAL_BIAS = 72
INITIAL_N = 128
MAXINT = 2147483647
SKEW = 38
TMAX = 26
TMIN = 1

Class Method Summary

Class Method Detail

def self.adapt(delta, numpoints, firsttime) #

Bias adaptation function


[View source]
def self.decode(input : Slice(UInt8)) #

Main decode


[View source]
def self.decode_digit(cp) #

decode_digit(cp) returns the numeric value of a basic code point (for use in representing integers) in the range 0 to base-1, or base if cp is does not represent a value.


[View source]
def self.encode(input : String, &) #

Main encode function


[View source]
def self.encode_basic(bcp, flag) #

encode_basic(bcp,flag) forces a basic code point to lowercase if flag is zero, uppercase if flag is nonzero, and returns the resulting code point. The code point is unchanged if it is caseless. The behavior is undefined if bcp is not a basic code point.


[View source]
def self.encode_digit(d) #

encode_digit(d,flag) returns the basic code point whose value (when used for representing integers) is d, which needs to be in the range 0 to base-1. The lowercase form is used unless flag is nonzero, in which case the uppercase form is used. The behavior is undefined if flag is nonzero and digit d has no uppercase form.


[View source]