1URI::_punycode(3)     User Contributed Perl Documentation    URI::_punycode(3)
2
3
4

NAME

6       URI::_punycode - encodes Unicode string in Punycode
7

SYNOPSIS

9         use strict;
10         use warnings;
11         use utf8;
12
13         use URI::_punycode qw(encode_punycode decode_punycode);
14
15         # encode a unicode string
16         my $punycode = encode_punycode('http://☃.net'); # http://.net-xc8g
17         $punycode = encode_punycode('bücher'); # bcher-kva
18         $punycode = encode_punycode('他们为什么不说中文'); # ihqwcrb4cv8a8dqg056pqjye
19
20         # decode a punycode string back into a unicode string
21         my $unicode = decode_punycode('http://.net-xc8g'); # http://☃.net
22         $unicode = decode_punycode('bcher-kva'); # bücher
23         $unicode = decode_punycode('ihqwcrb4cv8a8dqg056pqjye'); # 他们为什么不说中文
24

DESCRIPTION

26       URI::_punycode is a module to encode / decode Unicode strings into
27       Punycode <https://tools.ietf.org/html/rfc3492>, an efficient encoding
28       of Unicode for use with IDNA <https://tools.ietf.org/html/rfc5890>.
29

FUNCTIONS

31       All functions throw exceptions on failure. You can "catch" them with
32       Syntax::Keyword::Try or Try::Tiny. The following functions are exported
33       by default.
34
35   encode_punycode
36         my $punycode = encode_punycode('http://☃.net');  # http://.net-xc8g
37         $punycode = encode_punycode('bücher'); # bcher-kva
38         $punycode = encode_punycode('他们为什么不说中文') # ihqwcrb4cv8a8dqg056pqjye
39
40       Takes a Unicode string (UTF8-flagged variable) and returns a Punycode
41       encoding for it.
42
43   decode_punycode
44         my $unicode = decode_punycode('http://.net-xc8g'); # http://☃.net
45         $unicode = decode_punycode('bcher-kva'); # bücher
46         $unicode = decode_punycode('ihqwcrb4cv8a8dqg056pqjye'); # 他们为什么不说中文
47
48       Takes a Punycode encoding and returns original Unicode string.
49

AUTHOR

51       Tatsuhiko Miyagawa <miyagawa@bulknews.net> is the author of
52       IDNA::Punycode which was the basis for this module.
53

SEE ALSO

55       IDNA::Punycode, RFC 3492 <https://tools.ietf.org/html/rfc3492>, RFC
56       5891 <https://tools.ietf.org/html/rfc5891>
57
59       This library is free software; you can redistribute it and/or modify it
60       under the same terms as Perl itself.
61
62
63
64perl v5.30.1                      2020-01-30                 URI::_punycode(3)
Impressum