Re: URL encode

From: Date: Wed, 23 Feb 2005 16:01:36 +0000
Subject: Re: URL encode
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-209244@lists.php.net to get a copy of this message
Bruno Santos wrote:
Hello. Im having some trouble when getting a query from a $_GET method the problem is, when using $_GET, i get some charaters decoded as html entities. if i submit the word %sara% (example), is ok but, if i submi the word %carlos%, i get Êrlos, witch is the translation of html entity %ca
so a user is entering '%carlos%'? firstly it _looks_ like you are adding the '%' signs in order to have this affect the way a search query is performed - if this is the case maybe you should consider wrapping the search term on the server side _after_ you have recieved the string? also if you run the following: echo urlencode("%carlos%"); you will see that in order to pass the '%' sign in a url it will need to be encoded as '%25'; if you create the string '%carlos%' on the server then you can perform urlencode() on it before outputting the url and it should come back as you expect... if on the otherhand this is user entered info then you may need to use javascript to encode the string before the forms values are submitted.
how can i can resolve it ?? ive tryed with htmlentities, urlencode, urldecode, etc...
you don't need to run any function over the incoming value - the webserver will urldecode what ever GET string is incoming... if the string is not properly encoded in the first place (i.e. before it is used as a request to the webserver) then there is no proper way of retrieving the original value AFAICS
help ? cheers Bruno Santos


« previous php.general (#209244) next »