{"source":"doc/api/punycode.md","modules":[{"textRaw":"punycode","name":"punycode","stability": 0,"stabilityText":"Deprecated","desc":"<p><strong>The version of the punycode module bundled in Node.js is being deprecated</strong>.\nIn a future major version of Node.js this module will be removed. Users\ncurrently depending on the <code>punycode</code> module should switch to using the\nuserland-provided [Punycode.js][]module instead.</p>\n<p>The <code>punycode</code> module is a bundled version of the [Punycode.js][]module. It\ncan be accessed using:</p>\n<pre><code class=\"lang-js\">const punycode = require(&#39;punycode&#39;);\n</code></pre>\n<p>[Punycode][]is a character encoding scheme defined by RFC 3492 that is\nprimarily intended for use in Internationalized Domain Names. Because host\nnames in URLs are limited to ASCII characters only, Domain Names that contain\nnon-ASCII characters must be converted into ASCII using the Punycode scheme.\nFor instance, the Japanese character that translates into the English word,\n<code>&#39;example&#39;</code> is <code>&#39;例&#39;</code>. The Internationalized Domain Name, <code>&#39;例.com&#39;</code> (equivalent\nto <code>&#39;example.com&#39;</code>) is represented by Punycode as the ASCII string\n<code>&#39;xn--fsq.com&#39;</code>.</p>\n<p>The <code>punycode</code> module provides a simple implementation of the Punycode standard.</p>\n<p><em>Note</em>: The <code>punycode</code> module is a third-party dependency used by Node.js and\nmade available to developers as a convenience. Fixes or other modifications to\nthe module must be directed to the [Punycode.js][]project.</p>\n","methods":[{"textRaw":"punycode.decode(string)","type":"method","name":"decode","meta":{"added":["v0.5.1"]},"signatures":[{"params":[{"textRaw":"`string`{String}","name":"string","type":"String"}]},{"params":[{"name":"string"}]}],"desc":"<p>The <code>punycode.decode()</code> method converts a [Punycode][]string of ASCII-only\ncharacters to the equivalent string of Unicode codepoints.</p>\n<pre><code class=\"lang-js\">punycode.decode(&#39;maana-pta&#39;); // &#39;mañana&#39;\npunycode.decode(&#39;--dqo34k&#39;); // &#39;☃-⌘&#39;\n</code></pre>\n"},{"textRaw":"punycode.encode(string)","type":"method","name":"encode","meta":{"added":["v0.5.1"]},"signatures":[{"params":[{"textRaw":"`string`{String}","name":"string","type":"String"}]},{"params":[{"name":"string"}]}],"desc":"<p>The <code>punycode.encode()</code> method converts a string of Unicode codepoints to a\n[Punycode][]string of ASCII-only characters.</p>\n<pre><code class=\"lang-js\">punycode.encode(&#39;mañana&#39;); // &#39;maana-pta&#39;\npunycode.encode(&#39;☃-⌘&#39;); // &#39;--dqo34k&#39;\n</code></pre>\n"},{"textRaw":"punycode.toASCII(domain)","type":"method","name":"toASCII","meta":{"added":["v0.6.1"]},"signatures":[{"params":[{"textRaw":"`domain`{String}","name":"domain","type":"String"}]},{"params":[{"name":"domain"}]}],"desc":"<p>The <code>punycode.toASCII()</code> method converts a Unicode string representing an\nInternationalized Domain Name to [Punycode][]. Only the non-ASCII parts of the\ndomain name will be converted. Calling <code>punycode.toASCII()</code> on a string that\nalready only contains ASCII characters will have no effect.</p>\n<pre><code class=\"lang-js\">// encode domain names\npunycode.toASCII(&#39;mañana.com&#39;);  // &#39;xn--maana-pta.com&#39;\npunycode.toASCII(&#39;☃-⌘.com&#39;);   // &#39;xn----dqo34k.com&#39;\npunycode.toASCII(&#39;example.com&#39;); // &#39;example.com&#39;\n</code></pre>\n"},{"textRaw":"punycode.toUnicode(domain)","type":"method","name":"toUnicode","meta":{"added":["v0.6.1"]},"signatures":[{"params":[{"textRaw":"`domain`{String}","name":"domain","type":"String"}]},{"params":[{"name":"domain"}]}],"desc":"<p>The <code>punycode.toUnicode()</code> method converts a string representing a domain name\ncontaining [Punycode][]encoded characters into Unicode. Only the [Punycode][]\nencoded parts of the domain name are be converted.</p>\n<pre><code class=\"lang-js\">// decode domain names\npunycode.toUnicode(&#39;xn--maana-pta.com&#39;); // &#39;mañana.com&#39;\npunycode.toUnicode(&#39;xn----dqo34k.com&#39;);  // &#39;☃-⌘.com&#39;\npunycode.toUnicode(&#39;example.com&#39;);       // &#39;example.com&#39;\n</code></pre>\n"}],"properties":[{"textRaw":"punycode.ucs2","name":"ucs2","meta":{"added":["v0.7.0"]},"modules":[{"textRaw":"punycode.ucs2.decode(string)","name":"punycode.ucs2.decode(string)","meta":{"added":["v0.7.0"]},"desc":"<ul>\n<li><code>string</code>{String}</li>\n</ul>\n<p>The <code>punycode.ucs2.decode()</code> method returns an array containing the numeric\ncodepoint values of each Unicode symbol in the string.</p>\n<pre><code class=\"lang-js\">punycode.ucs2.decode(&#39;abc&#39;); // [0x61, 0x62, 0x63]\n// surrogate pair for U+1D306 tetragram for centre:\npunycode.ucs2.decode(&#39;\\uD834\\uDF06&#39;); // [0x1D306]\n</code></pre>\n","type":"module","displayName":"punycode.ucs2.decode(string)"},{"textRaw":"punycode.ucs2.encode(codePoints)","name":"punycode.ucs2.encode(codepoints)","meta":{"added":["v0.7.0"]},"desc":"<ul>\n<li><code>codePoints</code>{Array}</li>\n</ul>\n<p>The <code>punycode.ucs2.encode()</code> method returns a string based on an array of\nnumeric code point values.</p>\n<pre><code class=\"lang-js\">punycode.ucs2.encode([0x61, 0x62, 0x63]); // &#39;abc&#39;\npunycode.ucs2.encode([0x1D306]); // &#39;\\uD834\\uDF06&#39;\n</code></pre>\n","type":"module","displayName":"punycode.ucs2.encode(codePoints)"}]},{"textRaw":"punycode.version","name":"version","meta":{"added":["v0.6.1"]},"desc":"<p>Returns a string identifying the current [Punycode.js][]version number.</p>\n"}],"type":"module","displayName":"punycode"}]}