1Net::LibIDN2(3)       User Contributed Perl Documentation      Net::LibIDN2(3)
2
3
4

NAME

6       Net::LibIDN2 - Perl bindings for GNU Libidn2
7

SYNOPSIS

9         use Net::LibIDN2 ':all';
10
11         idn2_lookup_u8(Encode::encode_utf8("m\N{U+00FC}\N{U+00DF}li.de"))
12           eq 'xn--mli-5ka8l.de';
13
14         idn2_register_u8(
15           Encode::encode_utf8("m\N{U+00FC}\N{U+00DF}li"),
16           "xn--mli-5ka8l"
17         ) eq 'xn--mli-5ka8l';
18
19         Encode::decode_utf8(idn2_to_unicode_88("xn--mli-5ka8l.de"))
20           eq "m\N{U+00FC}\N{U+00DF}li"
21

DESCRIPTION

23       Provides bindings for GNU Libidn2, a C library for handling
24       internationalized domain names based on IDNA 2008, Punycode and TR46.
25
26   Functions
27       Net::LibIDN2::idn2_lookup_u8($src [, $flags [, $rc]]);
28           Alternative name idn2_to_ascii_8.
29
30           Perform IDNA2008 lookup string conversion on domain name $src, as
31           described in section 5 of RFC 5891. Note that the input string must
32           be encoded in UTF-8 and be in Unicode NFC form.
33
34           Pass IDN2_NFC_INPUT in $flags to convert input to NFC form before
35           further processing. IDN2_TRANSITIONAL and IDN2_NONTRANSITIONAL do
36           already imply IDN2_NFC_INPUT.
37
38           Pass IDN2_ALABEL_ROUNDTRIP in flags to convert any input A-labels
39           to U-labels and perform additional testing. This is default if used
40           with a libidn version >= 2.2. To switch this behavior off, pass
41           IDN2_NO_ALABEL_ROUNDTRIP
42
43           Pass IDN2_TRANSITIONAL to enable Unicode TR46 transitional
44           processing, and IDN2_NONTRANSITIONAL to enable Unicode TR46 non-
45           transitional processing.
46
47           Multiple flags may be specified by binary or:ing them together, for
48           example IDN2_NFC_INPUT | IDN2_ALABEL_ROUNDTRIP.
49
50           If linked to library GNU Libidn version > 2.0.3:
51           IDN2_USE_STD3_ASCII_RULES disabled by default.  Previously we were
52           eliminating non-STD3 characters from domain strings such as
53           _443._tcp.example.com, or IPs 1.2.3.4/24 provided to libidn2
54           functions.  That was an unexpected regression for applications
55           switching from libidn and thus it is no longer applied by default.
56           Use IDN2_USE_STD3_ASCII_RULES to enable that behavior again.
57
58           On error, returns undef. If a scalar variable is provided in $rc,
59           returns the internal libidn2 C library result code as well.
60
61       Net::LibIDN2::idn2_lookup_ul($src [, $flags [, $rc]]);
62           Alternative name idn2_to_ascii_l.
63
64           Similar to function "idn2_lookup_u8" but $src is assumed to be
65           encoded in the locale's default coding system, and will be
66           transcoded to UTF-8 and NFC normalized before returning the result.
67
68       Net::LibIDN2::idn2_register_u8($ulabel [, $alabel, [$flags, [$rc]]]);
69           Perform IDNA2008 register string conversion on domain label $ulabel
70           and $alabel, as described in section 4 of RFC 5891. Note that the
71           input ulabel must be encoded in UTF-8 and be in Unicode NFC form.
72
73           Pass IDN2_NFC_INPUT in $flags to convert input $ulabel to NFC form
74           before further processing.
75
76           It is recommended to supply both $ulabel and $alabel for better
77           error checking, but supplying just one of them will work. Passing
78           in only $alabel is better than only $ulabel. See RFC 5891 section 4
79           for more information.
80
81           On error, returns undef. If a scalar variable is provided in $rc,
82           returns the internal libidn2 C library result code as well.
83
84       Net::LibIDN2::idn2_register_u8($ulabel [, $alabel, [$flags, [$rc]]]);
85           Similar to function "idn2_register_ul" but $ulabel is assumed to be
86           encoded in the locale's default coding system, and will be
87           transcoded to UTF-8 and NFC normalized before returning the result.
88
89       Net::LibIDN2::idn2_to_unicode_88($input, [$flags, [$rc]]);
90           Converts a possibly ACE encoded domain name in UTF-8 format into a
91           an UTF-8 encoded string (punycode decoding).
92
93           On error, returns undef. If a scalar variable is provided in $rc,
94           returns the internal libidn2 C library result code as well.
95
96       Net::LibIDN2::idn2_to_unicode_8l($input, [$flags, [$rc]]);
97           Similar to function "idn2_to_unicode_88" but the return value is
98           encoded in the locale's default coding system.
99
100       Net::LibIDN2::idn2_to_unicode_ll($input, [$flags, [$rc]]);
101           Similar to function "idn2_to_unicode_8l" but $input is also assumed
102           to be encoded in the locale's default coding system.
103
104       Net::LibIDN2::idn2_strerror($rc);
105           Convert internal libidn2 error code $rc to a humanly readable
106           string.
107
108       Net::LibIDN2::idn2_strerror_name($rc);
109           Convert internal libidn2 error code $rc to a string corresponding
110           to internal header file symbols names like IDN2_MALLOC.
111
112       Net::LibIDN2::id2n_check_version([$req_version])
113           Checks that the version of the underlying IDN2 C library is at
114           minimum the one given as a string in $req_version and if that is
115           the case returns the actual version string  of the underlying C
116           library or undef if the condition is not met. If no parameter is
117           passed to this function no check is done and only the version
118           string is returned.
119
120           See IDN2_VERSION for a suitable $req_version string, it corresponds
121           to  the idn2.h C header file version at compile time of this Perl
122           module.  Normally these two version numbers match, but if you
123           compiled this Perl module against an older libidn2  and then run it
124           with a newer libidn2 shared library they will be different.
125
126   Constants
127       IDN2_VERSION
128           Pre-processor symbol with a string that describe the C header file
129           version number at compile time of this Perl module. Used together
130           with idn2_check_version() to verify header file and run-time
131           library consistency.
132
133       IDN2_VERSION_NUMBER
134           Pre-processor symbol with a hexadecimal value describing the C
135           header file version number at compile time of this Perl module. For
136           example, when the header version is 1.2.4711 this symbol will have
137           the value 0x01021267. The last four digits are used to enumerate
138           development snapshots, but for all public releases they will be
139           0000.
140
141       IDN2_VERSION_MAJOR
142           Pre-processor symbol for the major version number (decimal).  The
143           version scheme is major.minor.patchlevel.
144
145       IDN2_VERSION_MINOR
146           Pre-processor symbol for the minor version number (decimal).  The
147           version scheme is major.minor.patchlevel.
148
149       IDN2_VERSION_PATCH
150           Pre-processor symbol for the patch level number (decimal).  The
151           version scheme is major.minor.patchlevel.
152
153       IDN2_LABEL_MAX_LENGTH
154           Constant specifying the maximum length of a DNS label to 63
155           characters, as specified in RFC 1034.
156
157       IDN2_DOMAIN_MAX_LENGTH
158           Constant specifying the maximum size of the wire encoding of a DNS
159           domain to 255 characters, as specified in RFC 1034. Note that the
160           usual printed representation of a domain name is limited to 253
161           characters if it does not end with a period or 254 characters if it
162           ends with a period.
163
164   Result codes
165       "Net::LibIDN2::IDN2_OK" Successful return.
166       "Net::LibIDN2::IDN2_MALLOC" Memory allocation error.
167       "Net::LibIDN2::IDN2_NO_CODESET" Could not determine locale string
168       encoding format.
169       "Net::LibIDN2::IDN2_ICONV_FAIL" Could not transcode locale string to
170       UTF-8.
171       "Net::LibIDN2::IDN2_ENCODING_ERROR" Unicode data encoding error.
172       "Net::LibIDN2::IDN2_NFC" Error normalizing string.
173       "Net::LibIDN2::IDN2_PUNYCODE_BAD_INPUT" Punycode invalid input.
174       "Net::LibIDN2::IDN2_PUNYCODE_BIG_OUTPUT" Punycode output buffer too
175       small.
176       "Net::LibIDN2::IDN2_PUNYCODE_OVERFLOW" Punycode conversion would
177       overflow.
178       "Net::LibIDN2::IDN2_TOO_BIG_DOMAIN" Domain name longer than 255
179       characters.
180       "Net::LibIDN2::IDN2_TOO_BIG_LABEL" Domain label longer than 63
181       characters.
182       "Net::LibIDN2::IDN2_INVALID_ALABEL" Input A-label is not valid.
183       "Net::LibIDN2::IDN2_UALABEL_MISMATCH" Input A-label and U-label does
184       not match.
185       "Net::LibIDN2::IDN2_NOT_NFC" String is not NFC.
186       "Net::LibIDN2::IDN2_2HYPHEN" String has forbidden two hyphens.
187       "Net::LibIDN2::IDN2_HYPHEN_STARTEND" String has forbidden
188       starting/ending hyphen.
189       "Net::LibIDN2::IDN2_LEADING_COMBINING" String has forbidden leading
190       combining character.
191       "Net::LibIDN2::IDN2_DISALLOWED" String has disallowed character.
192       "Net::LibIDN2::IDN2_CONTEXTJ" String has forbidden context-j character.
193       "Net::LibIDN2::IDN2_CONTEXTJ_NO_RULE" String has context-j character
194       with no rull.
195       "Net::LibIDN2::IDN2_CONTEXTO" String has forbidden context-o character.
196       "Net::LibIDN2::IDN2_CONTEXTO_NO_RULE" String has context-o character
197       with no rull.
198       "Net::LibIDN2::IDN2_UNASSIGNED" String has forbidden unassigned
199       character.
200       "Net::LibIDN2::IDN2_BIDI" String has forbidden bi-directional
201       properties.
202       "Net::LibIDN2::IDN2_DOT_IN_LABEL" Label has forbidden dot (TR46).
203       "Net::LibIDN2::IDN2_INVALID_TRANSITIONAL" Label has character forbidden
204       in transitional mode (TR46).
205       "Net::LibIDN2::IDN2_INVALID_NONTRANSITIONAL" Label has character
206       forbidden in non-transitional mode (TR46).
207

AUTHOR

209       Thomas Jacob, https://github.com/gnuthor
210

SEE ALSO

212       perl(1), RFC 5890-5893, TR 46, https://gitlab.com/libidn/libidn2.
213
214
215
216perl v5.34.0                      2021-07-22                   Net::LibIDN2(3)
Impressum