I need to convert the punycode NIATO-OTABD
to nñiñatoñ
.
I found a text converter in JavaScript the other day, but the punycode conversion doesn't work if there's a dash in the middle.
Any suggestion to fix the "dash" issue?
I need to convert the punycode NIATO-OTABD
to nñiñatoñ
.
I found a text converter in JavaScript the other day, but the punycode conversion doesn't work if there's a dash in the middle.
Any suggestion to fix the "dash" issue?
I took the time to create the punycode below. It it based on the C code in RFC 3492. To use it with domain names you have to remove/add
xn--
from/to the input/output to/from decode/encode.The
utf16-class
is necessary to convert from JavaScripts internal character representation to unicode and back.There are also
ToASCII
andToUnicode
functions to make it easier to convert between puny-coded IDN and ASCII.Update Licence:
From RFC3492:
I put my work in this punycode and utf16 in the public domain. It would be nice to get an email telling me in what project you use it.