tHud Posted February 7, 2011 Share Posted February 7, 2011 Hi I am using urlencode to create links to pages. It all works well until I come up against 'TradeMark' or 'Registered' etc. The snippet below works up to a point... <?php $pagename = urlencode("Test Device® CR Plus"); touch ("$pagename.htm"); echo "<a href=\"$pagename\">Test Device® CR Plus</a>"; ?> The point being, it creates a file called Test+Device%AE+CR+Plus.htm as you would expect. However, when clicking on that link, I get a 404. I checked in the browser window and in the FTP pane and the file is definitely there. However, when clicking on Test+Device%AE+CR+Plus.htm in a browser file listing, this Test+Device%25AE+CR+Plus.htm is what I see in the browser navigation bar. Any thoughts on how I can get around this? Thanks. Link to comment https://forums.phpfreaks.com/topic/226974-urlencode-issue-maybe/ Share on other sites More sharing options...
tHud Posted February 7, 2011 Author Share Posted February 7, 2011 Unable to edit - so I will just mention here that I left .htm out in the echo statement. $pagename.htm It doesn't affect the actual problem. Thanks. Link to comment https://forums.phpfreaks.com/topic/226974-urlencode-issue-maybe/#findComment-1171051 Share on other sites More sharing options...
BlueSkyIS Posted February 7, 2011 Share Posted February 7, 2011 Any thoughts on how I can get around this? remove trademark or register symbol from the url. Link to comment https://forums.phpfreaks.com/topic/226974-urlencode-issue-maybe/#findComment-1171111 Share on other sites More sharing options...
tHud Posted February 7, 2011 Author Share Posted February 7, 2011 If I were able/allowed to do that, I would have done so. Any other thoughts, please? Link to comment https://forums.phpfreaks.com/topic/226974-urlencode-issue-maybe/#findComment-1171115 Share on other sites More sharing options...
BlueSkyIS Posted February 7, 2011 Share Posted February 7, 2011 not url-encoding seems to work for me. $pagename = "Test Device® CR Plus.htm"; touch ($pagename); echo "<a href='$pagename'>Test Device® CR Plus</a>"; Link to comment https://forums.phpfreaks.com/topic/226974-urlencode-issue-maybe/#findComment-1171122 Share on other sites More sharing options...
tHud Posted February 7, 2011 Author Share Posted February 7, 2011 Thanks. However if I do that, the browser shows this link... DEVICE%C2%AE%201000%20AED.htm but the generated file is... DEVICE® 1000 AED.htm Link to comment https://forums.phpfreaks.com/topic/226974-urlencode-issue-maybe/#findComment-1171132 Share on other sites More sharing options...
BlueSkyIS Posted February 7, 2011 Share Posted February 7, 2011 oh i see. so in your post you are using the html ® i misunderstood and thought you were using the actual symbol, which is what I did in my example. in other words: i did not change the symbol to it's HTML counterpart before placing it into the url. Link to comment https://forums.phpfreaks.com/topic/226974-urlencode-issue-maybe/#findComment-1171135 Share on other sites More sharing options...
tHud Posted February 7, 2011 Author Share Posted February 7, 2011 Yes, sorry for not explaining more clearly. The snippet is from a larger program. The original data may have been entered as a TM or 'R' etc. but have been encoded prior to entry into the database. Link to comment https://forums.phpfreaks.com/topic/226974-urlencode-issue-maybe/#findComment-1171140 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.