Convert to punycode

I’m having trouble converting to punycode…this just outputs “apple.com
when I’m expecting

"xn--80ak6aa92e.com"

any suggestions?

<cfset text = "apple.com">
   
<cfset idn = createObject("java", "java.net.IDN").toASCII(text)>

<cfoutput>
<!--- expected result should be:  xn--80ak6aa92e.com --->
<li>idn=<pre>#idn#</pre>
</cfoutput>

EDIT: Sorry, I was misunderstanding the problem, punycode expects CYRILLIC chrs like greek or russian which my example is not using - which is why it appears not to work.

1 Like