Re: mozilla & urlencode

From: Date: Sun, 05 Jun 2005 03:31:09 +0000
Subject: Re: mozilla & urlencode
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-216394@lists.php.net to get a copy of this message
This works: "District of St. Francis" http://www.glquebec.org/tezt.php#District+of+St.+Francis <a name="District+of+St.+Francis"></a> This does not: "Montréal District #2" http://www.glquebec.org/tezt.php#Montr%E9al+District+%232 <a name="Montr%E9al+District+%232"></a> I'm beginning to see the problem lies with the French character "é". I don't see it being #. In any case, I cannot change existing fields. How can I get this working? Pablo Gosse wrote:
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.
I generate the link using urlencode. if ("" != $mydata->district){ echo " - <a href=\"#".urlencode($mydata->district)."\">$mydata->district</a></h1>"; }else{ echo "</h1>"; } The link is named:
      echo "<hr size=1><a name=\"".urlencode($mydata->district)."\"></a><h2>$mydata->district</h2>\n"; 


« previous php.general (#216394) next »