why cant I see the word ? (encoding problem?)

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
kfirlevin
Forum Newbie
Posts: 2
Joined: Thu Nov 30, 2006 6:08 am

why cant I see the word ? (encoding problem?)

Post by kfirlevin »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


when im writing the url:
[url]http://www.google.com/translate_t?ie=UTF8&hl=en&langpair=en|ar&text=book[/url]
in the address bar, I see that the word book and the arabic translation are there. 


but when  i use the following php code to get the data and print it to screen, 
the arabic translation is , I think encoede badly,

Code: Select all

$url = "http://www.google.com/translate_t?ie=UTF8&hl=en&langpair=en|ar&text=book";
	$fp = fopen($url,"r");
	echo fread($fp, (1024*16));
	fclose($fp);

why is it ?? what do i have to do to print it and to see the translation


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
User avatar
aaronhall
DevNet Resident
Posts: 1040
Joined: Tue Aug 13, 2002 5:10 pm
Location: Back in Phoenix, missing the microbrews
Contact:

Post by aaronhall »

Try this instead:

Code: Select all

$url = "http://www.google.com/translate_t?ie=UTF8&hl=en&langpair=en|ar&text=book"; 
echo file_get_contents($url);
kfirlevin
Forum Newbie
Posts: 2
Joined: Thu Nov 30, 2006 6:08 am

Post by kfirlevin »

aaronhall wrote:Try this instead:

Code: Select all

$url = "http://www.google.com/translate_t?ie=UTF8&hl=en&langpair=en|ar&text=book"; 
echo file_get_contents($url);

take a look, it brings me the same result - the translation cannot be seen

http://sun4u.co.il/test/read_site.php5
Post Reply