Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Javascript implementation of Punycode (IDN) encode/decode? 1

Status
Not open for further replies.

shadedecho

Programmer
Oct 4, 2002
336
US
I'm looking to get a javascript implementation of IDNA conversion (RFC 3490), which involves:

* StringPrep/NamePrep (RFC 3454/3491) unicode string preparation
* Punycode (RFC 3492) translation between unicode and ascii representations

LibIDN ( has C, java, and C# implementations of the relevant functions ("ToAscii", "ToUnicode", and other dependency functions). The biggest problem though is that this is GPL, and I need something that is at least LGPL or preferably more open/free -- GPL will not work.

---------
Verisign's SDK (with C and Java implementations) is BSD licensed and is possibly more promising on this front:
And, they also list here some other language implementations of note:

---------
Ultimately, I'm trying to get an actionscript implementation working, but I figured if I could get it into javascript, I could certainly figure out the conversion to actionscript as the languages are so nearly identical.

Does anyone know how I could go about getting this done? (BTW, this is non-comercial, for a free, open-source project I run).
 
yeah, i did that before coming here. I almost mentioned it, but when you go to that thing, it has nothing to download. quite the frustrating tease! :)
 
i should say, i went to that first link already... the second link in the search results does have some promising help, although I'm not entirely sure if it has everything I need, I'll have to study closer... in any case, it's probably the best thing I have to go on right now, so thank you!

-------------
I'm pretty sure that second(and third) link from 'StackOverflow' was not in this section of google search results a few days ago when I first started researching this topic -- because I did that identical google search and didn't find it.

Also, the fourth link I'd found before, it's a dead end. And the 6th link is now THIS tek-tips thread, so that shows you how shallow the results field is on this topic!
 
Thank you trollacious... you have been helpful in this. Unfortunately the ASP, .Net, and Java versions those links reference are all distributed with "unfriendly" license terms... that is, I ultimately have to include whatever code I get for this task in an open-source project I run which is MIT licensed... so I'd need, MIT, Apache, or BSD-style licensing, so some other compatible one like that.

GPL (Java code) is definitely out, and the ASP style code is under some proprietary license which prohibits changes to be redistributed (which is quite odd I think!). I couldn't find the source code for the .NET dll, but maybe if it can be found, perhaps its license is more open -- certainly the license on the dll itself is quite permissive. :)
 
Would it be appropriate to look at what the functions do in the ASP VBScript code and write your own from scratch in Actionscript? You'd have to write some of your own functions that are built into VBS that JS doesn't have, like trimming a string, too.

Lee
 
trollacious-yes, I'm thinking I will do exactly that, either with the javascript code found from the second link of the google search you suggested, or from the ASP.

The truth is, I started out looking for a complete IDNA implementation package in javascript/actionscript, but honestly the need I have is only for one way conversion -- that is, encoding -- for domain string comparison purposes, so I should be able to find the subset of that functionality from the code provided.

I'm not too wonderful with VBScript, so the javascript code might be a little easier for me to convert over. But I'll certainly also study the vbscript so I make sure I don't miss anything.

Obviously, this is a lot easier than starting from scratch with the C-code in the RFC. ;-)

-----
and for posterity sake, if I'm successful in this, I may very well just do the full IDNA in actionscript and release it for public consumption, but then only take a subset of that to use in my actual target application.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top