View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
Claus Färber > Net-IDN-Encode-2.100 > Net::IDN::Punycode



Annotate this POD


Open  1
View/Report Bugs
Module Version: 1.101   Source   Latest Release: Net-IDN-Encode-2.400


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


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


This module implements the Punycode encoding. 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.

Note that this module does not do any string preparation as specified by Nameprep/IDNA2008/PRECIS and does not add nor remove the ACE prefix (xn--). Thus, use Net::IDN::Encode if you want to convert domain names.


Usually, it is not a good idea to use this module directly. If you convert domain labels (or other strings) without proper prepration, 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, you might be fooled by different Unicode normalization forms (for example, some environments might automatically convert your data to NFD, which breaks IDNA).


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

The following functions are available:


Encodes $input with Punycode and returns the result.

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


Decodes $input with Punycode and returns the result.

This function will throw an exception on invalid input.


Tatsuhiko Miyagawa <> (versions 0.01 to 0.02)

Claus Färber <> (versions 1.000 and higher)


Copyright 2002-2004 Tatsuhiko Miyagawa <>

Copyright 2007-2013 Claus Färber <>

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


RFC 3492 (, IETF::ACE, Convert::RACE

syntax highlighting: