grabmail
02-25-2006, 06:49 PM
echo '<a href="%22sucks%22">test</a>';
it links to <A href="http://localhost/"sucks">http://localhost/"sucks"</a> instead.
But I want to link to http://localhost/%22sucks%22
How do i resolve this?
2detailed
02-25-2006, 07:02 PM
<?php
echo "<a href=\"/%22sucks%22\">test</a>\n";
?>
grabmail
02-25-2006, 07:47 PM
doesn't work.
it still links to http://localhost/"sucks"
I have no idea why it convert %22 to "
Dismounted
02-25-2006, 07:50 PM
%22 is the hex code for "
Just like %20 is the hex code for a space
http://www.blooberry.com/indexdot/html/topics/urlencoding.htm
getweb
02-25-2006, 08:47 PM
This should work... it escapes the first %-sign (HEX 25) so it doesn't get translated:
echo "<a href=\"%2522sucks%2522\">test</a>\n";
// or
echo '<a href="%2522sucks%2522">test</a>' . "\n";
But seriously... why?! :smash:
deuce868
02-25-2006, 11:13 PM
also check out the urlencode method. It might take care of the exscaping for you.
http://us3.php.net/urlencode
grabmail
02-26-2006, 06:20 AM
oh ****. this is really weird stuff.
previously, when i click on a link
http://localhost/"sucks"
my address bar will show http://localhost/"sucks"
Now,
my address bar shows http://localhost/%22sucks%22, which is what i want.