Jump to content

Putting " and > inside a link.


the_oliver

Recommended Posts

Hello.

 

I have a files which could be something like:

 

gunk>stuff"yes.htm

 

But when i link to them this causes havouc with the HTML!  I tried relpacing them with \> and \"  but that didn't make any diffrence.  Whats the way round this?

 

Thanks.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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>

 

Link to comment
Share on other sites

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?

 

 

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.