220. Punycode

DNS Punycode Handling

220.1. Authors

  • Lukas Ocilka <lukas.ocilka@suse.cz>

  • Tags: Unstable

220.2. Summary of Module Globals

List of Global Functions

  • DecodeDomainName - Decodes the domain name (relative or FQDN) from the Punycode.

  • DecodePunycodes - Converts list of Punycode strings into their UTF-8 representation.

  • DocodeDomainNames - Decodes the list of domain names to their Unicode representation. This function is similar to DecodePunycodes but it works with every string as a domain name (that means every domain name is parsed by dots and separately evaluated).

  • EncodeDomainName - Encodes the domain name (relative or FQDN) to the Punycode.

  • EncodePunycodes - Converts list of UTF-8 strings into their Punycode ASCII repserentation.

  • GetMaximumCacheSize - Returns the maximum cache size (sum of already converted strings).

  • SetMaximumCacheSize - Offers to set the maximum cache size (sum of already converted strings).

List of Global Variables

    220.3. Global Functions

    220.3.1. DecodeDomainName

    Decodes the domain name (relative or FQDN) from the Punycode.

    Function parameters

    • string encoded_domain_name

    Return value

    • string - decoded domain_name

    Example 83. 

    	DecodeDomainName("xn--ala-qma83eb.xn--jlinka-3mb.go.home")
    		-> "ŞíŞala.jůlinka.go.home"


    220.3.2. DecodePunycodes

    Converts list of Punycode strings into their UTF-8 representation.

    Function parameters

    • list <string> punycode_strings

    Return value

    • list <string> - decoded_strings

    220.3.3. DocodeDomainNames

    Decodes the list of domain names to their Unicode representation. This function is similar to DecodePunycodes but it works with every string as a domain name (that means every domain name is parsed by dots and separately evaluated).

    Function parameters

    • list <string> encoded_domain_names

    Return value

    • list <string> - decoded_domain_names

    Example 84. 

     	DocodeDomainNames(["mx1.example.org", "xp3.example.org.", "xn--ala-qma83eb.org.example."])
    		-> ["mx1.example.org", "xp3.example.org.", "ŞíŞala.org.example."]


    220.3.4. EncodeDomainName

    Encodes the domain name (relative or FQDN) to the Punycode.

    Function parameters

    • string decoded_domain_name

    Return value

    • string - encoded domain_name

    Example 85. 

    	EncodeDomainName("ŞíŞala.jůlinka.go.home")
    		-> "xn--ala-qma83eb.xn--jlinka-3mb.go.home"


    220.3.5. EncodePunycodes

    Converts list of UTF-8 strings into their Punycode ASCII repserentation.

    Function parameters

    • list <string> punycode_strings

    Return value

    • list <string> - encoded_strings

    220.3.6. GetMaximumCacheSize

    Returns the maximum cache size (sum of already converted strings).

    Return value

    • integer - maximum_cache_size

    See also:

    • SetMaximumCacheSize()

    220.3.7. SetMaximumCacheSize

    Offers to set the maximum cache size (sum of already converted strings).

    Function parameters

    • integer new_max_size

    Return value

    • void

    See also:

    • GetMaximumCacheSize()

    220.4. Global Variables

    220.5. Module Requirements

    none