IDN Forums - Internationalized Domain Names  
Home | Advertise on idnforums | Premium Membership

Go Back   IDN Forums - Internationalized Domain Names > IDN Discussions > General Discussion

General Discussion Feel free to talk about anything and everything in this board.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 4th June 2011, 02:33 AM
Ryu's Avatar
Ryu Ryu is offline
Moderator
 
Join Date: Nov 2007
Posts: 1,158
iTrader: (14)
Rep Power: 977
Ryu is on a distinguished roadRyu is on a distinguished roadRyu is on a distinguished roadRyu is on a distinguished roadRyu is on a distinguished roadRyu is on a distinguished road
Any easy way to insert punycode converter to a website?

Does any of you guys know an easy way to insert punycode converter to a website? It doesn't have to be highly functional like that of idntools.com. Just simple one-domain-at-a-time converter is all I need.
Reply With Quote
  #2 (permalink)  
Old 4th June 2011, 07:35 AM
Veteran
 
Join Date: Sep 2005
Posts: 2,699
iTrader: (50)
Rep Power: 1246
gammascalper is on a distinguished roadgammascalper is on a distinguished roadgammascalper is on a distinguished roadgammascalper is on a distinguished roadgammascalper is on a distinguished roadgammascalper is on a distinguished road
Re: Any easy way to insert punycode converter to a website?

Here's one option.
__________________
-----
Offers by e-mail, PM or forum post valid for 5 days
Reply With Quote
  #3 (permalink)  
Old 4th June 2011, 03:09 PM
Ryu's Avatar
Ryu Ryu is offline
Moderator
 
Join Date: Nov 2007
Posts: 1,158
iTrader: (14)
Rep Power: 977
Ryu is on a distinguished roadRyu is on a distinguished roadRyu is on a distinguished roadRyu is on a distinguished roadRyu is on a distinguished roadRyu is on a distinguished road
Re: Any easy way to insert punycode converter to a website?

Thanks gamma.

It looks easy. But I couldn't get it to work. I tried copying the whole thing from the scroll bar and pasting it onto my html file. It didn't work. It didn't even show a text box. Instead, I just got the whole thing as a text. What am I missing?

The website has an instruction as follows but I can't understand.

Quote:
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.
Reply With Quote
  #4 (permalink)  
Old 4th June 2011, 07:04 PM
Veteran
 
Join Date: Sep 2005
Posts: 2,699
iTrader: (50)
Rep Power: 1246
gammascalper is on a distinguished roadgammascalper is on a distinguished roadgammascalper is on a distinguished roadgammascalper is on a distinguished roadgammascalper is on a distinguished roadgammascalper is on a distinguished road
Re: Any easy way to insert punycode converter to a website?

Hey Ryu. That's the javascript function which won't do anything by itself. You'll have to call it from your input box to do the encoding/decoding.

Ask the stackoverflow guys to show how it works with an html input box -- they love answering questions
__________________
-----
Offers by e-mail, PM or forum post valid for 5 days
Reply With Quote
  #5 (permalink)  
Old 5th June 2011, 01:46 AM
Ryu's Avatar
Ryu Ryu is offline
Moderator
 
Join Date: Nov 2007
Posts: 1,158
iTrader: (14)
Rep Power: 977
Ryu is on a distinguished roadRyu is on a distinguished roadRyu is on a distinguished roadRyu is on a distinguished roadRyu is on a distinguished roadRyu is on a distinguished road
Re: Any easy way to insert punycode converter to a website?

Hmmm. It's starting to sound a little bit complexed but I'll see if I can handle it.

Thanks Gamma for your help.
Reply With Quote
  #6 (permalink)  
Old 5th June 2011, 02:26 AM
Veteran
 
Join Date: Sep 2005
Posts: 2,699
iTrader: (50)
Rep Power: 1246
gammascalper is on a distinguished roadgammascalper is on a distinguished roadgammascalper is on a distinguished roadgammascalper is on a distinguished roadgammascalper is on a distinguished roadgammascalper is on a distinguished road
Re: Any easy way to insert punycode converter to a website?

I find javascript tricky, but this way you don't have to use a server side script like php and can just throw it into your html pages.

That script above is a function and it appeared as text because you have to tell the serevr what it is by enclosing the entire function with this. Can't recall if it must be near the top of the html, but doesn't hurt to place it there:
Code:
<script type="text/javascript">

</script>
And put this at the end...

Code:
<script type="text/javascript">
document.write("<p>" + punycode.ToUnicode("xn--khoahc-tl8b.com") + "</p>");
</script>
You'll see that it correctly does the conversion... if you can figure out how to capture the input using js, you've got a working routine.

I think you'll want to look for a way to capture the input in a variable, then call it with something like:

Code:
document.write("<p>" + punycode.ToUnicode(ryus_variable) + "</p>");
Some good reading here with clear examples: http://www.w3schools.com/JS/js_examples.asp
__________________
-----
Offers by e-mail, PM or forum post valid for 5 days

Last edited by gammascalper; 5th June 2011 at 02:39 AM..
Reply With Quote
  #7 (permalink)  
Old 8th June 2011, 01:51 PM
Ryu's Avatar
Ryu Ryu is offline
Moderator
 
Join Date: Nov 2007
Posts: 1,158
iTrader: (14)
Rep Power: 977
Ryu is on a distinguished roadRyu is on a distinguished roadRyu is on a distinguished roadRyu is on a distinguished roadRyu is on a distinguished roadRyu is on a distinguished road
Re: Any easy way to insert punycode converter to a website?

Got it! It took me a while, but I finally figured out how this works. Thank you Gamma.

I'm using this to convert Unicode to Punycode, so I rewrote the code from

Quote:
document.write("<p>" + punycode.ToUnicode(ryus_variable) + "</p>");
to

Quote:
document.write("<p>" + punycode.ToASCII(ryus_variable) + "</p>");
"punycode.ToASCII" sounds very strange, but anyway, it worked!

Now I need to re-learn html codes to make a simple text box.
Reply With Quote
  #8 (permalink)  
Old 8th June 2011, 05:51 PM
squirrel's Avatar
Senior Member
 
Join Date: Nov 2009
Posts: 2,940
iTrader: (11)
Rep Power: 7081
squirrel is a name known to all
squirrel is a name known to allsquirrel is a name known to allsquirrel is a name known to allsquirrel is a name known to allsquirrel is a name known to allsquirrel is a name known to allsquirrel is a name known to allsquirrel is a name known to allsquirrel is a name known to allsquirrel is a name known to all
Re: Any easy way to insert punycode converter to a website?

For the record, I think there is a similar function in php 5.3
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 02:35 AM.

Site Sponsors
Your ad here
buy t-shirt
מחיר הזהב

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0
Copyright idnforums.com 2005

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54