Re: Re: [PHP] urlencode and google search query

2004-10-28 Thread Joel CARNAT
On Thu, Oct 28 2004 - 00:31, Marek Kilimajer wrote:
 
 I meant get parameters to google:
 
 http://www.google.com/search?q=helpie=utf-8oe=utf-8
 
 you need to change ie parameter ^^ to whatever encoding you are using.

 yepee ! finally got it.
 so the tweak was :
* don't use urlencode()
* add ie=utf-8oe=utf-8

 thanks a lot !

-- 
,-- This mail runs -.
` NetBSD/i386 --'

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



Re: [PHP] urlencode and google search query

2004-10-27 Thread Marek Kilimajer
Joel CARNAT wrote:
Hi,
I have a submit form from where I can search things to several sites
(google, freshmeat, ...). I use PHP4/urlencode to generate the correct
query. But it seems google does not use the right encoding :(
example - query=programme télé:

$engine = $_POST[engine];
$query = urlencode($_POST[query]);
switch($engine) {
case google:
echo htmlmeta http-equiv=\refresh\ 
content=\0;url=http://www.google.fr/search?q=$query\;/html;
break;
case freshmeat:
echo htmlmeta http-equiv=\refresh\ 
content=\0;url=http://freshmeat.net/search/?q=$query\;/html;
break;
}

when I use my code, the final URL is:
http://www.google.fr/search?q=programme+t%E9l%E9
when I search programme télé straight from google's page, the URL is:

http://www.google.fr/search?num=20hl=frq=programme+t%C3%A9l%C3%A9btnG=Recherchermeta=
i also tried (by hand):
http://www.google.fr/search?q=programme+t%C3%A9l%C3%A9
which is working.
how comes urlencode generates %E9 and google generates %C3%A9 ?
is google using some specific encoding ? any tweak to encode the google way ?
you can specify your encoding to google using ie parameter. and output 
encoding with oe. google usualy uses UTF-8, that's why some single 
characters are encoded in two bytes.

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


Re: Re: [PHP] urlencode and google search query

2004-10-27 Thread Joel CARNAT
On Wed, Oct 27 2004 - 23:41, Marek Kilimajer wrote:
 how comes urlencode generates %E9 and google generates %C3%A9 ?
 is google using some specific encoding ? any tweak to encode the google 
 way ?
 
 you can specify your encoding to google using ie parameter. and output 

 hum... I don't get what you mean :(
 there is no parameter to the urlencode php function, isn't it ?

 encoding with oe. google usualy uses UTF-8, that's why some single 
 characters are encoded in two bytes.
 
 I tried :
echo htmlmeta http-equiv=\refresh\ 
content=\0;url=http://www.google.fr/search?q=.utf8_encode($query).\/html;
 which acts the same, aka %E9

 and
$query = utf8_encode($_POST[query]);
 which is worse than ever :)
 it produces : %20t%C3%83%C6%92%C3%82%C2%A9   %-)

 can you clarify what you mean when you say use the ie param and encoding with oe.

 sorry if those questions seems sily, but I'm not a heavy php coder ;)

TIA,
Jo
-- 

,-- This mail runs -.
` OpenBSD/sparc64 --'

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



Re: [PHP] urlencode and google search query

2004-10-27 Thread Marek Kilimajer
Joel CARNAT wrote:
On Wed, Oct 27 2004 - 23:41, Marek Kilimajer wrote:
how comes urlencode generates %E9 and google generates %C3%A9 ?
is google using some specific encoding ? any tweak to encode the google 
way ?
you can specify your encoding to google using ie parameter. and output 

 hum... I don't get what you mean :(
 there is no parameter to the urlencode php function, isn't it ?

encoding with oe. google usualy uses UTF-8, that's why some single 
characters are encoded in two bytes.
 
 I tried :
echo htmlmeta http-equiv=\refresh\ content=\0;url=http://www.google.fr/search?q=.utf8_encode($query).\/html;
 which acts the same, aka %E9

 and
$query = utf8_encode($_POST[query]);
 which is worse than ever :)
 it produces : %20t%C3%83%C6%92%C3%82%C2%A9   %-)
 can you clarify what you mean when you say use the ie param and encoding with oe.
 sorry if those questions seems sily, but I'm not a heavy php coder ;)
I meant get parameters to google:
http://www.google.com/search?q=helpie=utf-8oe=utf-8
you need to change ie parameter ^^ to whatever encoding you are using.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php