Jump to content

Putting " and > inside a link.


the_oliver

Recommended Posts

Hello,

 

I tried all the options on that page and always got something like:

e011_Again_It's_!_$_&_'_(_)_|_/%22_;_:_/_._%3C_%3E_`.htm in the link rather then the

e011_Again_It's_!_$_&_'_(_)_|_\"_;_:_\_._<_>_`.htm  i was expecting.

 

(sory its so long!  Just checking to see what causes problems!)

 

They all replacesd the symbols with something else, rater then just telling it to do something like skip over them.

 

Thanks.

Actual file name:

e011_Again_It's_!_$_&_'_(_)_|_\"_;_:_\_._<_>_`.htm

Code:

$htmlurl = "e011_Again_It's_!_$_&_'_(_)_|_\\\"_;_:_\_._<_>_`.htm";
$text .= "<a href=\"".urlencode($htmlurl)."\" target=\"blank\">$htmlurl</a>";

If i do View Source:

<p>Your newsletter has been published as a web page.</p><p>It can be viewed online at: <a href="e011_Again_It%27s_%21_%26_%27_%28_%29_%7C_%22_%3B_%3A_%5C_._%3C_%3E_%60.htm" target="blank">e011_Again_It's_!_&_'_(_)_|_"_;_:_\_._<_>_`.htm</a>

 

If you decode the output URL...

 

<pre>
<?php
echo urldecode('e011_Again_It%27s_%21_%26_%27_%28_%29_%7C_%22_%3B_%3A_%5C_._%3C_%3E_%60.htm');
?>
</pre>

 

...you get...

 

e011_Again_It's_!_&_'_(_)_|_"_;_:_\_._<_>_`.htm

 

...which isn't your file name. You're losing the dollar sign and the backslash before the double quote. Based on this, it looks like $htmlurl goes through some interpolation prior to being decoded. What does echo $htmlurl; show you?

 

 

I think that must have been a typo.

 

I ran:

$htmlurl = "e011_Again_It's_!_$_&_'_(_)_|_\\\"_;_:_\_._<_>_`.htm";
$en = urlencode($htmlurl);
echo $en."<br>";        //ENCODED
echo $htmlurl."<br>"; //PLAIN
echo urldecode($htmlurl);

//DECODED

 

And got

e011_Again_It%27s_%21_%26_%27_%28_%29_%7C_%5C%22_%3B_%3A_%5C_._%3C_%3E_%60.htm

e011_Again_It's_!_&_'_(_)_|_\"_;_:_\_._<_>_`.htm

e011_Again_It's_!_&_'_(_)_|_\"_;_:_\_._<_>_`.htm

 

 

 

Thanks for your help so far!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.