Re: opening utf-8 files - chinese mb characters

From: Date: Wed, 08 Apr 2009 16:05:18 +0000
Subject: Re: opening utf-8 files - chinese mb characters
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-291227@lists.php.net to get a copy of this message
Per Jessen wrote:
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??
Check that the page really is displayed with the right encoding - in FF, Ctrl-I. /Per
yes it is. I checked it. UTF-8. It looks like it has to do something with wget, the programm I used to retrieve the file. Or Linux itself. The language-pack for china is not on the suse box, and I can't even find the chinese language through yast "languages". This might explain, why I can open it from a mounted samba share directly, but not through the apache webserver who reads it from the linux system. Did somebody else have such a probl. before?

« previous php.general (#291227) next »