143 lines
3.9 KiB
HTML
143 lines
3.9 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of URI::_punycode</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>URI::_punycode</H1>
|
|
Section: User Contributed Perl Documentation (3pm)<BR>Updated: 2020-02-08<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
URI::_punycode - encodes Unicode string in Punycode
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
|
|
|
|
|
|
|
|
<PRE>
|
|
use strict;
|
|
use warnings;
|
|
use utf8;
|
|
|
|
use URI::_punycode qw(encode_punycode decode_punycode);
|
|
|
|
# encode a unicode string
|
|
my $punycode = encode_punycode('<A HREF="http://☃.net');">http://☃.net');</A> # <A HREF="http://.net-xc8g">http://.net-xc8g</A>
|
|
$punycode = encode_punycode('bücher'); # bcher-kva
|
|
$punycode = encode_punycode('他们为什么不说中文'); # ihqwcrb4cv8a8dqg056pqjye
|
|
|
|
# decode a punycode string back into a unicode string
|
|
my $unicode = decode_punycode('<A HREF="http://.net-xc8g');">http://.net-xc8g');</A> # <A HREF="http://☃.net">http://☃.net</A>
|
|
$unicode = decode_punycode('bcher-kva'); # bücher
|
|
$unicode = decode_punycode('ihqwcrb4cv8a8dqg056pqjye'); # 他们为什么不说中文
|
|
|
|
</PRE>
|
|
|
|
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
|
|
|
|
URI::_punycode is a module to encode / decode Unicode strings into
|
|
Punycode <<A HREF="https://tools.ietf.org/html/rfc3492">https://tools.ietf.org/html/rfc3492</A>>, an efficient
|
|
encoding of Unicode for use with <FONT SIZE="-1">IDNA</FONT> <<A HREF="https://tools.ietf.org/html/rfc5890">https://tools.ietf.org/html/rfc5890</A>>.
|
|
<A NAME="lbAE"> </A>
|
|
<H2>FUNCTIONS</H2>
|
|
|
|
|
|
|
|
All functions throw exceptions on failure. You can <TT>"catch"</TT> them with
|
|
Syntax::Keyword::Try or Try::Tiny. The following functions are exported
|
|
by default.
|
|
<A NAME="lbAF"> </A>
|
|
<H3>encode_punycode</H3>
|
|
|
|
|
|
|
|
|
|
|
|
<PRE>
|
|
my $punycode = encode_punycode('<A HREF="http://☃.net');">http://☃.net');</A> # <A HREF="http://.net-xc8g">http://.net-xc8g</A>
|
|
$punycode = encode_punycode('bücher'); # bcher-kva
|
|
$punycode = encode_punycode('他们为什么不说中文') # ihqwcrb4cv8a8dqg056pqjye
|
|
|
|
</PRE>
|
|
|
|
|
|
<P>
|
|
|
|
Takes a Unicode string (UTF8-flagged variable) and returns a Punycode
|
|
encoding for it.
|
|
<A NAME="lbAG"> </A>
|
|
<H3>decode_punycode</H3>
|
|
|
|
|
|
|
|
|
|
|
|
<PRE>
|
|
my $unicode = decode_punycode('<A HREF="http://.net-xc8g');">http://.net-xc8g');</A> # <A HREF="http://☃.net">http://☃.net</A>
|
|
$unicode = decode_punycode('bcher-kva'); # bücher
|
|
$unicode = decode_punycode('ihqwcrb4cv8a8dqg056pqjye'); # 他们为什么不说中文
|
|
|
|
</PRE>
|
|
|
|
|
|
<P>
|
|
|
|
Takes a Punycode encoding and returns original Unicode string.
|
|
<A NAME="lbAH"> </A>
|
|
<H2>AUTHOR</H2>
|
|
|
|
|
|
|
|
Tatsuhiko Miyagawa <<I><A HREF="mailto:miyagawa@bulknews.net">miyagawa@bulknews.net</A></I>> is the author of
|
|
IDNA::Punycode which was the basis for this module.
|
|
<A NAME="lbAI"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
|
|
|
|
IDNA::Punycode, <FONT SIZE="-1">RFC 3492</FONT> <<A HREF="https://tools.ietf.org/html/rfc3492">https://tools.ietf.org/html/rfc3492</A>>,
|
|
<FONT SIZE="-1">RFC 5891</FONT> <<A HREF="https://tools.ietf.org/html/rfc5891">https://tools.ietf.org/html/rfc5891</A>>
|
|
<A NAME="lbAJ"> </A>
|
|
<H2>COPYRIGHT AND LICENSE</H2>
|
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify
|
|
it under the same terms as Perl itself.
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="1"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="2"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="3"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="4"><A HREF="#lbAE">FUNCTIONS</A><DD>
|
|
<DL>
|
|
<DT id="5"><A HREF="#lbAF">encode_punycode</A><DD>
|
|
<DT id="6"><A HREF="#lbAG">decode_punycode</A><DD>
|
|
</DL>
|
|
<DT id="7"><A HREF="#lbAH">AUTHOR</A><DD>
|
|
<DT id="8"><A HREF="#lbAI">SEE ALSO</A><DD>
|
|
<DT id="9"><A HREF="#lbAJ">COPYRIGHT AND LICENSE</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:59 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|