Re: urlencode and google search query

From: Date: Wed, 27 Oct 2004 22:31:58 +0000
Subject: Re: urlencode and google search query
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-200489@lists.php.net to get a copy of this message
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 "<html><meta 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=help&ie=utf-8&oe=utf-8 you need to change ie parameter ----^^ to whatever encoding you are using.

« previous php.general (#200489) next »