Re: opening utf-8 files - chinese mb characters

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





Merlin Morgenstern wrote:
Hello everybody,

I am having some trouble with utf-8 encoding. The html file containes chinese characters and looks ok, when opened in a browser.

Now I want to extract some text from the file. In order to do this I do:

$handle = fopen($file, "r");
$contents = fread($handle, filesize($file));

echo $contents;

The chinese characters are gone by then. They show up as questinomarks or wired characters. To fix it I tried to add:

$contents = utf8_decode($contents);
header("Content-Type: text/html; charset=utf-8");

But still... no luck :-(

Has somebody an idea why??

Regards, Merlin

Something really strange: If I open the file directly from the hard drive inside the browser, the chinese characters show OK. If I open the file through the webserver the characters do not show OK. File encoding is set to utf-8.

Isn't this strange?°?!?

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux