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!

HTML Link mishaps! 2

Status
Not open for further replies.

Mute101

Programmer
Jun 28, 2001
428
GB
Hi all,

I am trying to create a link that will use a browser to log into an FTP site, the problem I have is the password starts with a hash (#) character. For some reason when I place a colon and hash together in the link itself my browser is converting it to a forward slash (/)

Heres the code (the names have been changed to protect the innocent!)

Code:
<a href="ftp://bob:#jump@some.ftp.site">Link</a>

or

Code:
<a href="ftp://bob&#58;&#35;jump@some.ftp.site">Link</a>

and heres the [link ftp://bob:#jump@some.ftp.site]problem[/url]

As you can see I have tried using the ascii characters but to no avail, does anyone out there know whats happening?

Cheers
Sim

----------------------------------------
I realised I was dyslexic when I went to a toga party dressed as a goat.
----------------------------------------
 
Cheers Dan,

This has worked but I can't find any reference to the hash entity in the HTML spec. Could you possibly point out a site with some information on this?

Thanks again
Simon

----------------------------------------
I realised I was dyslexic when I went to a toga party dressed as a goat.
----------------------------------------
 
I didn't get this from a spec - and I'm not even sure which spec I'd find it in, as it's more of a URL / protocol thing than an HTML thing. You could try the HTTP spec.

I arrived at %23 by converting the ASCII value for a hash symbol (35) into hex (23) and prepending a percentage sign. You can also find the value by typing this into your address bar:

Code:
javascript:alert(escape('#'));

Hope this helps,
Dan


[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
ASCII lookup table:

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Essex Steam UK for steam enthusiasts
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top