Re: [PHP] URL encode

2005-02-23 Thread Jochem Maas
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


Re: [PHP] URL encode

2005-02-23 Thread Richard Lynch
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

You probably *THINK* you are getting that, because when you print it out
in your browser as part of the URL, you print out:
%carlos

Some really stupid browsers (Microsoft IE) will assume you forgot the ; at
the end of %ca; and turn that into the html entity.

But that's just the browser being stupid, not your data being wrong.

Use View Source in your browser to see what's really in your output.

 how can i can resolve it ??

 ive tryed with htmlentities, urlencode, urldecode, etc...

Most likely, there is nothing to solve, and none of those are needed.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] URL encode/decode problem

2004-09-13 Thread Greg Donald
On Mon, 13 Sep 2004 16:51:59 +0300, Rosen [EMAIL PROTECTED] wrote:
 I have follow problem: One form whitch send some text fields to my PHP
 script. But before send data, the form makes
 javascript command escape for text fields. The text fields may contain
 characters +, quotes, etc.
 The form post data with GET method. And then I can't get correctly posted
 data in my PHP script. How to unescape data with PHP?
 
 Can someone help me ?

stripslashes() perhaps?



-- 
Greg Donald
http://destiney.com/

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



Re: [PHP] URL encode/decode problem

2004-09-13 Thread Rosen
It will not work - Javascript function escape() return string as unicode
data - something like %u0431%u043E%u044F.

And I don't know how to decode these data as normal chars.



Greg Donald [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 On Mon, 13 Sep 2004 16:51:59 +0300, Rosen [EMAIL PROTECTED] wrote:
  I have follow problem: One form whitch send some text fields to my PHP
  script. But before send data, the form makes
  javascript command escape for text fields. The text fields may contain
  characters +, quotes, etc.
  The form post data with GET method. And then I can't get correctly
posted
  data in my PHP script. How to unescape data with PHP?
 
  Can someone help me ?

 stripslashes() perhaps?



 -- 
 Greg Donald
 http://destiney.com/

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



Re: [PHP] URL encode/decode problem

2004-09-13 Thread Greg Donald
On Mon, 13 Sep 2004 17:21:48 +0300, Rosen [EMAIL PROTECTED] wrote:
 It will not work - Javascript function escape() return string as unicode
 data - something like %u0431%u043E%u044F.

Well, normally I'd say urldecode() but I don't think it handles
unicode, so you may wanna check out the multi-byte string functions:

http://www.php.net/manual/en/ref.mbstring.php

-- 
Greg Donald
http://destiney.com/

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



Re: [PHP] URL encode/decode problem

2004-09-13 Thread Rosen
I changed the JScript to encode data not as unicode - now it code data as
%20%2B%20.
But when I get data with $_REQUEST[var] - I loose symbol + - with code
%2B.





Greg Donald [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 On Mon, 13 Sep 2004 17:21:48 +0300, Rosen [EMAIL PROTECTED] wrote:
  It will not work - Javascript function escape() return string as
unicode
  data - something like %u0431%u043E%u044F.

 Well, normally I'd say urldecode() but I don't think it handles
 unicode, so you may wanna check out the multi-byte string functions:

 http://www.php.net/manual/en/ref.mbstring.php

 -- 
 Greg Donald
 http://destiney.com/

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



Re: [PHP] URL encode/decode problem

2004-09-13 Thread Greg Donald
On Mon, 13 Sep 2004 18:35:58 +0300, Rosen [EMAIL PROTECTED] wrote:
 I changed the JScript to encode data not as unicode - now it code data as
 %20%2B%20.
 But when I get data with $_REQUEST[var] - I loose symbol + - with code
 %2B.

Can you change it back before you decode it?  Maybe with str_replace() ?


-- 
Greg Donald
http://destiney.com/

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



Re: [PHP] URL encode/decode problem

2004-09-13 Thread Rosen
The sending form works with JavaScript. When enter on some field combination
+  plus sign and space - JScript encode it - I see it with alert -
%2B%20 , but when new window opens on url bar shows +%20 - thath means
space only.


Greg Donald [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 On Mon, 13 Sep 2004 18:35:58 +0300, Rosen [EMAIL PROTECTED] wrote:
  I changed the JScript to encode data not as unicode - now it code data
as
  %20%2B%20.
  But when I get data with $_REQUEST[var] - I loose symbol + - with
code
  %2B.

 Can you change it back before you decode it?  Maybe with str_replace() ?


 -- 
 Greg Donald
 http://destiney.com/

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



Re: [PHP] URL Encode to send as form POSTed Items

2002-11-25 Thread Rasmus Lerdorf
You can't send POST data with a Location redirect.  You can do it by
connecting directly to port 80 of the remote server and sending the POST
data.

-R

On Mon, 25 Nov 2002, Zac Hillier wrote:

 Hi All,

 I would like to know if it's possible to use php to encode form variables as
 if they had come from a post form instead of a get form. I imagine I need to
 place them into a header but cannot find much to read that gives any
 information on this.

 I need to create form variables and than use header location to direct the
 user to another page that will process the form.

 I'm posting to another site which is why i have to use form variables. I
 would like to avoid using JavaScript as this takes longer, will not work on
 all machines.

 Thanks

 Zac


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



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




Re: [PHP] URL Encode

2001-04-09 Thread Christopher Allen

In one page from a series of pages where I am building arrays for future
use:

$item4_array = urlencode (serialize ($item4_array));
echo "input type=hidden name=item4_array value=$item4_array";
---
On my last page I send an email so I need the info that was stored:



$item4_array = unserialize(urldecode($item4_array));
$message .=" DIMS: L $item4_array[2] W $item4_array[3] H $item4_array[4]
\n";
$message .="Item Weight $item4_array[1] \n";


 Hey there,

 does anybody have any info regarding urlencode and rawurlencode


HTH--

ccma


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] URL Encode

2001-04-09 Thread info

Thanks Chris,

but I understand urlenconde and urldecode - what I need to see in an example
where rawurlencode as opposed to urlencode is used and why.

Thanks,
Abe
- Original Message -
From: "Christopher Allen" [EMAIL PROTECTED]
To: "info" [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Monday, April 09, 2001 4:12 PM
Subject: Re: [PHP] URL Encode 


 In one page from a series of pages where I am building arrays for future
 use:

 $item4_array = urlencode (serialize ($item4_array));
 echo "input type=hidden name=item4_array value=$item4_array";
 ---
 On my last page I send an email so I need the info that was stored:



 $item4_array = unserialize(urldecode($item4_array));
 $message .=" DIMS: L $item4_array[2] W $item4_array[3] H $item4_array[4]
 \n";
 $message .="Item Weight $item4_array[1] \n";


  Hey there,
 
  does anybody have any info regarding urlencode and rawurlencode


 HTH--

 ccma



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] URL Encode

2001-02-10 Thread PHPBeginner.com

UrlEncode()

www.php.net/urlencode



Sincerely,

 Maxim Maletsky
 Founder, Chief Developer

 PHPBeginner.com (Where PHP Begins)
 [EMAIL PROTECTED]
 www.phpbeginner.com





-Original Message-
From: David Smith [mailto:[EMAIL PROTECTED]]
Sent: Saturday, February 10, 2001 6:50 AM
To: PHP List Post
Subject: [PHP] URL Encode


I know this have been covered before but I can't find it in my thousands of
emails... How would I URL Encode the following...


I am retrieving a variable like ? echo "$SearchCity"; ? but for example if
it is Hilton Head Island I need it to add the + signs as Hilton+Head+Island
so Netscape won't crash.

Thanks...


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] URL Encode

2001-02-09 Thread Boget, Chris

 I know this have been covered before but I can't find it in 
 my thousands of emails... How would I URL Encode the following...
 I am retrieving a variable like ? echo "$SearchCity"; ? but 
 for example if it is Hilton Head Island I need it to add the 
 + signs as Hilton+Head+Island so Netscape won't crash.

Funny enough, the function you are looking for is:

urlencode();

The docs are your friend.

Chris