RE: [PHP] mozilla & urlencode

From: Date: Sat, 04 Jun 2005 06:31:16 +0000
Subject: RE: [PHP] mozilla & urlencode
Groups: php.general 
Request: Send a blank email to php-general+get-216359@lists.php.net to get a copy of this message
<snip> echo "<a name=\"".urlencode($mydata->district)."\"></a>"; <a name="Montr%E9al+District+%234"></a> http://foo.org/_private/directory.php#Montr%E9al+District+%234 works in IE6, but Mozilla will not accept it. Mozilla does not work. Am I approaching this wrong? Should I create my HTML this way? echo "<a name=\"".$mydata->district."\"></a>"; <a name="Montréal District #4"></a> If I do, Mozilla prferes this: http://foo.org/_private/directory.php#Montr%E9al%20District%20#4 or http://foo.org/_private/directory.php#Montr%E9al%20District%20%234 IE refuses it and prefers: http://foo.org/_private/directory.php#Montr%E9al+District+%234 </snip> I'm not sure, but I see two things that might be causing this. First, why are spaces, which should be translated as %20, being represented as a '+'? Second, you have a # in the actual bookmark name, which I would assume is not valid since the # denotes the beginning of a bookmark. So perhaps IE compensates for this, but Mozilla reads the bookmark as looking for <a name="4"></a> because of the #4 at the end of the bookmark name. HTH, Pablo

« previous php.general (#216359) next »