Perl Diver 2.33
Main Environment Variables Perl Default Values Perl Config - Summary Perl Config - Full Installed Modules List Directory uptime Docs

Module Documentation
Details and documentation about a specific module, including version and documentation (if available). Note that while links to perldoc.com and search.cpan.org are provided, the module may be part of a larger distribution. If you reach a File Not Found page on either site, please try the parent module.

Net::IDN::Punycode

Name Net::IDN::Punycode
Version 2.500
Located at /usr/lib/x86_64-linux-gnu/perl5/5.34
File /usr/lib/x86_64-linux-gnu/perl5/5.34/Net/IDN/Punycode.pm
Is Core No
Search CPAN for this module Net::IDN::Punycode
Documentation Net::IDN::Punycode
Module Details Net::IDN::Punycode

NAME

Net::IDN::Punycode - A Bootstring encoding of Unicode for IDNA (RFC 3492)


SYNOPSIS

  use Net::IDN::Punycode qw(:all);
  $punycode = encode_punycode($unicode);
  $unicode  = decode_punycode($punycode);


DESCRIPTION

This module implements the Punycode encoding, and only the Punycode encoding.

This module does not implement any other steps required for converting internationalized domain names (IDNs) to and from ASCII. In particular, it does not do any string preparation as specified by Nameprep/IDNA2008/PRECIS and does not add nor remove the ACE prefix (xn--). Thus, use the Net::IDN::Encode manpage if you want to convert domain names.

Punycode is an instance of a more general algorithm called Bootstring, which allows strings composed from a small set of ``basic'' code points to uniquely represent any string of code points drawn from a larger set. Punycode is Bootstring with particular parameter values appropriate for IDNA.


WARNING

You may be tempted to use this module directly and add/remove the ACE prefix (xn--) in your code for performance reasons. Usually, this is not a good idea. If you convert domain labels (or other strings) without proper preparation, you may end up with an ASCII encoding that is not interoperable or even poses security issues due to spoofing.

Even if you think that your domain names are valid and already mapped to the correct form, this may not be true. For example, some environments might automatically convert your perfectly valid domain names to a different but equivalent Unicode normalization form (e.g., NFD instead of NFC), which already breaks IDNA.


FUNCTIONS

No functions are exported by default. You can use the tag :all or import them individually.

The following functions are available:

encode_punycode($input)
Encodes $input with Punycode and returns the result.

This function will throw an exception on invalid/unencodable input.

decode_punycode($input)
Decodes $input with Punycode and returns the result.

This function will throw an exception on invalid input.


AUTHORS

Tatsuhiko Miyagawa <miyagawa@bulknews.net> (versions 0.01 to 0.02)

Claus Färber <CFAERBER@cpan.org> (versions 1.000 and higher)


LICENSE

Copyright 2002-2004 Tatsuhiko Miyagawa <miyagawa@bulknews.net>

Copyright 2007-2014 Claus Färber <CFAERBER@cpan.org>

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


SEE ALSO

RFC 3492 (http://www.ietf.org/rfc/rfc3492.txt), the IETF::ACE manpage, the Convert::RACE manpage

Perl Diver brought to you by ScriptSolutions.com © 1997- 2026