1Net::IDN::Punycode(3) User Contributed Perl DocumentationNet::IDN::Punycode(3)
2
3
4
6 Net::IDN::Punycode - A Bootstring encoding of Unicode for IDNA
7 (RFC 3492)
8
10 use Net::IDN::Punycode qw(:all);
11 $punycode = encode_punycode($unicode);
12 $unicode = decode_punycode($punycode);
13
15 This module implements the Punycode encoding, and only the Punycode
16 encoding.
17
18 This module does not implement any other steps required for converting
19 internationalized domain names (IDNs) to and from ASCII. In particular,
20 it does not do any string preparation as specified by
21 Nameprep/IDNA2008/PRECIS and does not add nor remove the ACE prefix
22 ("xn--"). Thus, use Net::IDN::Encode if you want to convert domain
23 names.
24
25 Punycode is an instance of a more general algorithm called Bootstring,
26 which allows strings composed from a small set of "basic" code points
27 to uniquely represent any string of code points drawn from a larger
28 set. Punycode is Bootstring with particular parameter values
29 appropriate for IDNA.
30
32 You may be tempted to use this module directly and add/remove the ACE
33 prefix ("xn--") in your code for performance reasons. Usually, this is
34 not a good idea. If you convert domain labels (or other strings)
35 without proper preparation, you may end up with an ASCII encoding that
36 is not interoperable or even poses security issues due to spoofing.
37
38 Even if you think that your domain names are valid and already mapped
39 to the correct form, this may not be true. For example, some
40 environments might automatically convert your perfectly valid domain
41 names to a different but equivalent Unicode normalization form (e.g.,
42 NFD instead of NFC), which already breaks IDNA.
43
45 No functions are exported by default. You can use the tag ":all" or
46 import them individually.
47
48 The following functions are available:
49
50 encode_punycode($input)
51 Encodes $input with Punycode and returns the result.
52
53 This function will throw an exception on invalid/unencodable input.
54
55 decode_punycode($input)
56 Decodes $input with Punycode and returns the result.
57
58 This function will throw an exception on invalid input.
59
61 Tatsuhiko Miyagawa <miyagawa@bulknews.net> (versions 0.01 to 0.02)
62
63 Claus Faerber <CFAERBER@cpan.org> (versions 1.000 and higher)
64
66 Copyright 2002-2004 Tatsuhiko Miyagawa <miyagawa@bulknews.net>
67
68 Copyright 2007-2014 Claus Faerber <CFAERBER@cpan.org>
69
70 This library is free software; you can redistribute it and/or modify it
71 under the same terms as Perl itself.
72
74 RFC 3492 (<http://www.ietf.org/rfc/rfc3492.txt>), IETF::ACE,
75 Convert::RACE
76
77
78
79perl v5.30.0 2019-07-26 Net::IDN::Punycode(3)