Re: URL encode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux