Forum Moderators: coopster

Message Too Old, No Replies

Read in Chinese Chars from Google

Read in Chinese Chars from Google

         

gb_dev

4:00 pm on Jul 10, 2007 (gmt 0)

10+ Year Member




$str = file_get_contents('http://www.google.com/translate_t?langpair=en%7Czh&hl=en&ie=UTF8&text=hello');

The contents of the string from my BSD/Apache/PHP4.7 box does not contain (or i cannot read) the translated chinese characters.

The content is translated when surfing to the url on my windows box using IE7.

What am I missing here?

eelixduppy

7:57 pm on Jul 12, 2007 (gmt 0)



Try changing the charset:

header("Content-Type: text/html; charset=GB2312");
$str = file_get_contents('http://www.google.com/translate_t?langpair=en%7Czh&hl=en&ie=UTF8&text=hello');
echo $str;