{
  "source": "doc/api/punycode.md",
  "modules": [
    {
      "textRaw": "Punycode",
      "name": "punycode",
      "meta": {
        "changes": [
          {
            "version": "v7.0.0",
            "pr-url": "https://github.com/nodejs/node/pull/7941",
            "description": "Accessing this module will now emit a deprecation warning."
          }
        ]
      },
      "introduced_in": "v0.10.0",
      "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 <a href=\"https://mths.be/punycode\">Punycode.js</a> module instead.</p>\n<p>The <code>punycode</code> module is a bundled version of the <a href=\"https://mths.be/punycode\">Punycode.js</a> module. It\ncan be accessed using:</p>\n<pre><code class=\"lang-js\">const punycode = require(&#39;punycode&#39;);\n</code></pre>\n<p><a href=\"https://tools.ietf.org/html/rfc3492\">Punycode</a> 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>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 <a href=\"https://mths.be/punycode\">Punycode.js</a> project.</p>\n",
      "methods": [
        {
          "textRaw": "punycode.decode(string)",
          "type": "method",
          "name": "decode",
          "meta": {
            "added": [
              "v0.5.1"
            ],
            "changes": []
          },
          "signatures": [
            {
              "params": [
                {
                  "textRaw": "`string` {string} ",
                  "name": "string",
                  "type": "string"
                }
              ]
            },
            {
              "params": [
                {
                  "name": "string"
                }
              ]
            }
          ],
          "desc": "<p>The <code>punycode.decode()</code> method converts a <a href=\"https://tools.ietf.org/html/rfc3492\">Punycode</a> 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"
            ],
            "changes": []
          },
          "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<a href=\"https://tools.ietf.org/html/rfc3492\">Punycode</a> 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"
            ],
            "changes": []
          },
          "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 <a href=\"https://tools.ietf.org/html/rfc3492\">Punycode</a>. 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"
            ],
            "changes": []
          },
          "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 <a href=\"https://tools.ietf.org/html/rfc3492\">Punycode</a> encoded characters into Unicode. Only the <a href=\"https://tools.ietf.org/html/rfc3492\">Punycode</a>\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"
            ],
            "changes": []
          },
          "methods": [
            {
              "textRaw": "punycode.ucs2.decode(string)",
              "type": "method",
              "name": "decode",
              "meta": {
                "added": [
                  "v0.7.0"
                ],
                "changes": []
              },
              "signatures": [
                {
                  "params": [
                    {
                      "textRaw": "`string` {string} ",
                      "name": "string",
                      "type": "string"
                    }
                  ]
                },
                {
                  "params": [
                    {
                      "name": "string"
                    }
                  ]
                }
              ],
              "desc": "<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"
            },
            {
              "textRaw": "punycode.ucs2.encode(codePoints)",
              "type": "method",
              "name": "encode",
              "meta": {
                "added": [
                  "v0.7.0"
                ],
                "changes": []
              },
              "signatures": [
                {
                  "params": [
                    {
                      "textRaw": "`codePoints` {integer[]} ",
                      "name": "codePoints",
                      "type": "integer[]"
                    }
                  ]
                },
                {
                  "params": [
                    {
                      "name": "codePoints"
                    }
                  ]
                }
              ],
              "desc": "<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"
            }
          ]
        },
        {
          "textRaw": "`version` {string} ",
          "type": "string",
          "name": "version",
          "meta": {
            "added": [
              "v0.6.1"
            ],
            "changes": []
          },
          "desc": "<p>Returns a string identifying the current <a href=\"https://mths.be/punycode\">Punycode.js</a> version number.</p>\n"
        }
      ],
      "type": "module",
      "displayName": "Punycode"
    }
  ]
}
