The manakai project


A wrapper for Punycode encoding and decoding


  use Web::DomainName::Punycode;
  $out = encode_punycode $in;
  $out = decode_punycode $in;


The Web::DomainName::Punycode module provides functions to encode and decode Punycode.


This module exports two functions:

$out = encode_punycode $in

Encode the given string. It returns the Punycode-encoded representation, i.e. a string of ASCII characters. If the input cannot be encoded, undef is returned.

$out = decode_punycode $in

Decode the given string. It returns the Punycode-decoded representation, i.e. a string of Unicode characters. If the input cannot be decoded, e.g. because the input is not a Punycode-encoded string, undef is returned.


RFC 3492, Punycode: A Bootstring encoding of Unicode for Internationalized Domain Names in Applications (IDNA), March 2003. <>.

SuikaWiki:Punycode <>.

Although there are a number of Punycode implementations written in Perl, they are broken or badly designed (see "Implementation" section of <>). Relatively better implementations of Punycode include:

Net::LibIDN. GNU IDN Library - Libidn <>.


Previous version of the Web::DomainName::Punycode depend on one of these modules. However, for the ease of deployment, current version of the module contains a copy of URI::_punycode such that no XS or Perl module is required for encoding and decoding.


Wakaba <>.


This module contains a copy of URI::_punycode, whose credit contains:

  Tatsuhiko Miyagawa <> is the author of
  IDNA::Punycode v0.02 which was the basis for this module.


Copyright 2011-2012 Wakaba <>.

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