You are here iC Home > Perl > Data Encoding & Conversion > IDN Punycode

Perl

3.3 IDN Punycode

09.05.2008
3.2 Character Encoding [  up  ] - [ a - z ] - [ search PC ] - [ top ] 4 Date & Time in Perl

IDNA::Punycode is a module to encode / decode Unicode strings into Punycode, an efficient encoding of Unicode for use with IDNA.

Example

#!/usr/bin/perl -w
use strict;

use IDNA::Punycode;
use Unicode::String qw(latin1 utf8);

my $in = utf8($ARGV[0]);
my $in_ok = ($in->latin1);

my $punycode = encode_punycode($in_ok);

print "$ARGV[0]\n$punycode\n";

Usage

./punycode.pl bücher
bücher
xn--bcher-kva



See also:



Advanced search tips
3.2 Character Encoding [  up  ] - [ top ] 4 Date & Time in Perl



[ home ] - [ search ] - [ feedback ]

copyright by reto - created with mytexi