1
package Net::IDN::Punycode;
11
our $VERSION = "1.100";
12
$VERSION = eval $VERSION;
14
our @ISA = qw(Exporter);
17
our %EXPORT_TAGS = ( 'all' => [ qw(encode_punycode decode_punycode) ], );
18
Exporter::export_ok_tags(keys %EXPORT_TAGS);
22
XSLoader::load('Net::IDN::Punycode');
25
if (!defined(&encode_punycode)) {
26
require Net::IDN::Punycode::PP;
27
Net::IDN::Punycode::PP->import(qw(:all));
35
Net::IDN::Punycode - A Bootstring encoding of Unicode for IDNA (S<RFC 3492>)
39
use Net::IDN::Punycode qw(:all);
40
$punycode = encode_punycode($unicode);
41
$unicode = decode_punycode($punycode);
45
This module implements the Punycode encoding. Punycode is an instance of a more
46
general algorithm called Bootstring, which allows strings composed from a small
47
set of "basic" code points to uniquely represent any string of code points
48
drawn from a larger set. Punycode is Bootstring with particular parameter
49
values appropriate for IDNA.
51
Note that this module does not do any string preparation as specified by
52
I<Nameprep>/I<IDNA2008>/I<PRECIS> and does not add nor remove the ACE prefix
53
(C<xn-->). Thus, use L<Net::IDN::Encode> if you want to convert domain names.
57
Usually, it is not a good idea to use this module directly. If you convert
58
domain labels (or other strings) without proper prepration, you may end up with
59
an ASCII encoding that is not interoperable or even poses security issues due
62
Even if you think that your domain names are valid and already mapped to the
63
correct form, you might be fooled by different Unicode normalization forms (for
64
example, some environments might automatically convert your data to NFD, which
69
No functions are exported by default. You can use the tag C<:all>
70
or import them individually.
72
The following functions are available:
76
=item encode_punycode($input)
78
Encodes C<$input> with Punycode and returns the result.
80
This function will throw an exception on invalid/unencodable input.
82
=item decode_punycode($input)
84
Decodes C<$input> with Punycode and returns the result.
86
This function will throw an exception on invalid input.
92
Tatsuhiko Miyagawa E<lt>miyagawa@bulknews.netE<gt> (versions 0.01 to 0.02)
94
Claus FE<auml>rber E<lt>CFAERBER@cpan.orgE<gt> (versions 1.000 and higher)
98
Copyright 2002-2004 Tatsuhiko Miyagawa E<lt>miyagawa@bulknews.netE<gt>
100
Copyright 2007-2012 Claus FE<auml>rber E<lt>CFAERBER@cpan.orgE<gt>
102
This library is free software; you can redistribute it and/or modify
103
it under the same terms as Perl itself.
107
S<RFC 3492> (L<http://www.ietf.org/rfc/rfc3492.txt>),
108
L<IETF::ACE>, L<Convert::RACE>