Getting Unicode HREFs

This is a discussion on Getting Unicode HREFs within the Javascript forums in Programming Languages category; Hi all, I'm struggling with a problem of how to get an %-encoded Unicode URL from a DHTML anchor into a script variable but maintaining the encoding. See this example code. I've used { } instead of angle brackets to avoid this mail getting mangled by your viewer: {A id=x href=ftp:%E3%82%B9}hi{/A} {script} alert(x.outerHTML); alert(x.href); {/script} The alert for outerHTML shows the href still has % codes in it, but the alert for href doesn't, it shows odd characters. I'd like just the href part, but with the % codes in place. I've experimented with using 'escape', 'encodedURI' and 'encodedURIComponent' but ...

Go Back   Application Development Forum > Programming Languages > Javascript

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 03-02-2004, 08:17 AM
Dave Williams
Guest
 
Default Getting Unicode HREFs

Hi all, I'm struggling with a problem of how to get an %-encoded Unicode URL
from a DHTML anchor into a script variable but maintaining the encoding.

See this example code. I've used { } instead of angle brackets to avoid this
mail getting mangled by your viewer:

{A id=x href=ftp:%E3%82%B9}hi{/A}
{script}
alert(x.outerHTML);
alert(x.href);
{/script}

The alert for outerHTML shows the href still has % codes in it, but the
alert for href doesn't, it shows odd characters. I'd like just the href
part, but with the % codes in place.

I've experimented with using 'escape', 'encodedURI' and
'encodedURIComponent' but they all change other things too, I want the
originally encoded URL without any other characters such as spaces
additionally encoded.

It doesn't seem so much to ask, can anyone point me in the right direction?

Thanks,
DaveW




Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 09:23 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.