Net::LibIDN2 - Perl bindings for GNU Libidn2
use Net::LibIDN2 ':all'; idn2_lookup_u8("müßli.de") eq 'xn--mli-5ka8l.de'; idn2_register_u8("müßli", "xn--mli-5ka8l") eq 'xn--mli-5ka8l';
Provides bindings for GNU Libidn2, a C library for handling internationalized domain names according to IDNA 2008 (RFC 5890, RFC 5891, RFC 5892, RFC 5893).
Perform IDNA2008 lookup string conversion on domain name $src, as described in section 5 of RFC 5891. Note that the input string must be encoded in UTF-8 and be in Unicode NFC form.
Pass IDN2_NFC_INPUT in $flags to convert input to NFC form before further processing. Pass IDN2_ALABEL_ROUNDTRIP in flags to convert any input A-labels to U-labels and perform additional testing. Multiple flags may be specified by binary or:ing them together, for example IDN2_NFC_INPUT | IDN2_ALABEL_ROUNDTRIP.
On error, returns undef. If a scalar variable is provided in $rc, returns the internal libidn2 C library result code as well.
Similar to function idn2_lookup_u8 but $src is assumed to be encoded in the locale's default coding system, and will be transcoded to UTF-8 and NFC normalized before returning the result.
idn2_lookup_u8
Perform IDNA2008 register string conversion on domain label $ulabel and $alabel, as described in section 4 of RFC 5891. Note that the input ulabel must be encoded in UTF-8 and be in Unicode NFC form.
Pass IDN2_NFC_INPUT in $flags to convert input $ulabel to NFC form before further processing.
It is recommended to supply both $ulabel and $alabel for better error checking, but supplying just one of them will work. Passing in only $alabel is better than only $ulabel. See RFC 5891 section 4 for more information.
Similar to function idn2_register_ul but $ulabel is assumed to be encoded in the locale's default coding system, and will be transcoded to UTF-8 and NFC normalized before returning the result.
idn2_register_ul
Convert internal libidn2 error code $rc to a humanly readable string.
Convert internal libidn2 error code $rc to a string corresponding to internal header file symbols names like IDN2_MALLOC.
Checks that the version of the underlying IDN2 C library is at minimum the one given as a string in $req_version and if that is the case returns the actual version string of the underlying C library or undef if the condition is not met. If no parameter is passed to this function no check is done and only the version string is returned.
See IDN2_VERSION for a suitable $req_version string, it corresponds to the idn2.h C header file version at compile time of this Perl module. Normally these two version numbers match, but if you compiled this Perl module against an older libidn2 and then run it with a newer libidn2 shared library they will be different.
Pre-processor symbol with a string that describe the C header file version number at compile time of this Perl module. Used together with idn2_check_version() to verify header file and run-time library consistency.
Pre-processor symbol with a hexadecimal value describing the C header file version number at compile time of this Perl module. For example, when the header version is 1.2.4711 this symbol will have the value 0x01021267. The last four digits are used to enumerate development snapshots, but for all public releases they will be 0000.
Constant specifying the maximum length of a DNS label to 63 characters, as specified in RFC 1034.
Constant specifying the maximum size of the wire encoding of a DNS domain to 255 characters, as specified in RFC 1034. Note that the usual printed representation of a domain name is limited to 253 characters if it does not end with a period or 254 characters if it ends with a period.
Thomas Jacob, http://internet24.de
perl(1), RFC 5890-5893, http://www.gnu.org/software/libidn.
To install Net::LibIDN2, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::LibIDN2
CPAN shell
perl -MCPAN -e shell install Net::LibIDN2
For more information on module installation, please visit the detailed CPAN module installation guide.