Punycode.\+js is a robust Punycode converter that fully complies to \href{https://tools.ietf.org/html/rfc3492}{\texttt{ RFC 3492}} and \href{https://tools.ietf.org/html/rfc5891}{\texttt{ RFC 5891}}.

This Java\+Script library is the result of comparing, optimizing and documenting different open-\/source implementations of the Punycode algorithm\+:


\begin{DoxyItemize}
\item \href{https://tools.ietf.org/html/rfc3492\#appendix-C}{\texttt{ The C example code from RFC 3492}}
\item \href{http://opensource.apple.com/source/ICU/ICU-400.42/icuSources/common/punycode.c}{\texttt{ {\ttfamily punycode.\+c} by {\itshape Markus W. Scherer} (IBM)}}
\item \href{https://github.com/bnoordhuis/punycode/blob/master/punycode.c}{\texttt{ {\ttfamily punycode.\+c} by {\itshape Ben Noordhuis}}}
\item \href{http://stackoverflow.com/questions/183485/can-anyone-recommend-a-good-free-javascript-for-punycode-to-unicode-conversion/301287\#301287}{\texttt{ Java\+Script implementation by {\itshape some}}}
\item \href{https://github.com/joyent/node/blob/426298c8c1c0d5b5224ac3658c41e7c2a3fe9377/lib/punycode.js}{\texttt{ {\ttfamily punycode.\+js} by {\itshape Ben Noordhuis}}} (note\+: \href{https://github.com/joyent/node/issues/2072}{\texttt{ not fully compliant}})
\end{DoxyItemize}

This project was \href{https://github.com/joyent/node/blob/master/lib/punycode.js}{\texttt{ bundled}} with Node.\+js from \href{https://github.com/joyent/node/compare/975f1930b1...61e796decc}{\texttt{ v0.\+6.\+2+}} until \href{https://github.com/nodejs/node/pull/7941}{\texttt{ v7}} (soft-\/deprecated).

The current version supports recent versions of Node.\+js only. It provides a Common\+JS module and an ES6 module. For the old version that offers the same functionality with broader support, including Rhino, Ringo, Narwhal, and web browsers, see \href{https://github.com/bestiejs/punycode.js/releases/tag/v1.4.1}{\texttt{ v1.\+4.\+1}}.\hypertarget{md_sfcode_node_modules_punycode_README_autotoc_md23556}{}\doxysection{Installation}\label{md_sfcode_node_modules_punycode_README_autotoc_md23556}
Via \href{https://www.npmjs.com/}{\texttt{ npm}}\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{npm install punycode -\/-\/save }

\end{DoxyCode}


In \href{https://nodejs.org/}{\texttt{ Node.\+js}}\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{const punycode = require('punycode'); }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_punycode_README_autotoc_md23557}{}\doxysection{API}\label{md_sfcode_node_modules_punycode_README_autotoc_md23557}
\hypertarget{md_sfcode_node_modules_punycode_README_autotoc_md23558}{}\doxysubsection{$<$tt$>$punycode.\+decode(string)$<$/tt$>$}\label{md_sfcode_node_modules_punycode_README_autotoc_md23558}
Converts a Punycode string of ASCII symbols to a string of Unicode symbols.


\begin{DoxyCode}{0}
\DoxyCodeLine{// decode domain name parts}
\DoxyCodeLine{punycode.decode('maana-\/pta'); // 'mañana'}
\DoxyCodeLine{punycode.decode('-\/-\/dqo34k'); // '☃-\/⌘' }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_punycode_README_autotoc_md23559}{}\doxysubsection{$<$tt$>$punycode.\+encode(string)$<$/tt$>$}\label{md_sfcode_node_modules_punycode_README_autotoc_md23559}
Converts a string of Unicode symbols to a Punycode string of ASCII symbols.


\begin{DoxyCode}{0}
\DoxyCodeLine{// encode domain name parts}
\DoxyCodeLine{punycode.encode('mañana'); // 'maana-\/pta'}
\DoxyCodeLine{punycode.encode('☃-\/⌘'); // '-\/-\/dqo34k' }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_punycode_README_autotoc_md23560}{}\doxysubsection{$<$tt$>$punycode.\+to\+Unicode(input)$<$/tt$>$}\label{md_sfcode_node_modules_punycode_README_autotoc_md23560}
Converts a Punycode string representing a domain name or an email address to Unicode. Only the Punycoded parts of the input will be converted, i.\+e. it doesn’t matter if you call it on a string that has already been converted to Unicode.


\begin{DoxyCode}{0}
\DoxyCodeLine{// decode domain names}
\DoxyCodeLine{punycode.toUnicode('xn-\/-\/maana-\/pta.com');}
\DoxyCodeLine{// → 'mañana.com'}
\DoxyCodeLine{punycode.toUnicode('xn-\/-\/-\/-\/dqo34k.com');}
\DoxyCodeLine{// → '☃-\/⌘.com'}
\DoxyCodeLine{}
\DoxyCodeLine{// decode email addresses}
\DoxyCodeLine{punycode.toUnicode('джумла@xn-\/-\/p-\/8sbkgc5ag7bhce.xn-\/-\/ba-\/lmcq');}
\DoxyCodeLine{// → 'джумла@джpумлатест.bрфa' }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_punycode_README_autotoc_md23561}{}\doxysubsection{$<$tt$>$punycode.\+to\+ASCII(input)$<$/tt$>$}\label{md_sfcode_node_modules_punycode_README_autotoc_md23561}
Converts a lowercased Unicode string representing a domain name or an email address to Punycode. Only the non-\/\+ASCII parts of the input will be converted, i.\+e. it doesn’t matter if you call it with a domain that’s already in ASCII.


\begin{DoxyCode}{0}
\DoxyCodeLine{// encode domain names}
\DoxyCodeLine{punycode.toASCII('mañana.com');}
\DoxyCodeLine{// → 'xn-\/-\/maana-\/pta.com'}
\DoxyCodeLine{punycode.toASCII('☃-\/⌘.com');}
\DoxyCodeLine{// → 'xn-\/-\/-\/-\/dqo34k.com'}
\DoxyCodeLine{}
\DoxyCodeLine{// encode email addresses}
\DoxyCodeLine{punycode.toASCII('джумла@джpумлатест.bрфa');}
\DoxyCodeLine{// → 'джумла@xn-\/-\/p-\/8sbkgc5ag7bhce.xn-\/-\/ba-\/lmcq' }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_punycode_README_autotoc_md23562}{}\doxysubsection{$<$tt$>$punycode.\+ucs2$<$/tt$>$}\label{md_sfcode_node_modules_punycode_README_autotoc_md23562}
\hypertarget{md_sfcode_node_modules_punycode_README_autotoc_md23563}{}\doxysubsubsection{$<$tt$>$punycode.\+ucs2.\+decode(string)$<$/tt$>$}\label{md_sfcode_node_modules_punycode_README_autotoc_md23563}
Creates an array containing the numeric code point values of each Unicode symbol in the string. While \href{https://mathiasbynens.be/notes/javascript-encoding}{\texttt{ Java\+Script uses UCS-\/2 internally}}, 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.


\begin{DoxyCode}{0}
\DoxyCodeLine{punycode.ucs2.decode('abc');}
\DoxyCodeLine{// → [0x61, 0x62, 0x63]}
\DoxyCodeLine{// surrogate pair for U+1D306 TETRAGRAM FOR CENTRE:}
\DoxyCodeLine{punycode.ucs2.decode('\(\backslash\)uD834\(\backslash\)uDF06');}
\DoxyCodeLine{// → [0x1D306] }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_punycode_README_autotoc_md23564}{}\doxysubsubsection{$<$tt$>$punycode.\+ucs2.\+encode(code\+Points)$<$/tt$>$}\label{md_sfcode_node_modules_punycode_README_autotoc_md23564}
Creates a string based on an array of numeric code point values.


\begin{DoxyCode}{0}
\DoxyCodeLine{punycode.ucs2.encode([0x61, 0x62, 0x63]);}
\DoxyCodeLine{// → 'abc'}
\DoxyCodeLine{punycode.ucs2.encode([0x1D306]);}
\DoxyCodeLine{// → '\(\backslash\)uD834\(\backslash\)uDF06' }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_punycode_README_autotoc_md23565}{}\doxysubsection{$<$tt$>$punycode.\+version$<$/tt$>$}\label{md_sfcode_node_modules_punycode_README_autotoc_md23565}
A string representing the current Punycode.\+js version number.\hypertarget{md_sfcode_node_modules_punycode_README_autotoc_md23566}{}\doxysection{Author}\label{md_sfcode_node_modules_punycode_README_autotoc_md23566}
\tabulinesep=1mm
\begin{longtabu}spread 0pt [c]{*{1}{|X[-1]}|}
\hline
\PBS\centering \cellcolor{\tableheadbgcolor}\textbf{ \href{https://twitter.com/mathias}{\texttt{ }}    }\\\cline{1-1}
\endfirsthead
\hline
\endfoot
\hline
\PBS\centering \cellcolor{\tableheadbgcolor}\textbf{ \href{https://twitter.com/mathias}{\texttt{ }}    }\\\cline{1-1}
\endhead
\href{https://mathiasbynens.be/}{\texttt{ Mathias Bynens}}   \\\cline{1-1}
\end{longtabu}
\hypertarget{md_sfcode_node_modules_punycode_README_autotoc_md23567}{}\doxysection{License}\label{md_sfcode_node_modules_punycode_README_autotoc_md23567}
Punycode.\+js is available under the \href{https://mths.be/mit}{\texttt{ MIT}} license. 