Re: opening utf-8 files - chinese mb characters

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

 





Paul Gregg wrote:
In mail.php.general, Merlin Morgenstern <merlin_x@xxxxxxxxxxx> 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);

You don't want this.

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

You do want this.

But still... no luck :-(

Has somebody an idea why??

Try it with just the Content-Type: header addition.

header('Content-Type: text/html; charset=UTF-8');

Regards,
PG

Looks like this was a caching problem in firefox. The caracters show now in GB2312.

Next problem up... How to convert them into unicode :-)

I found the function to convert GB2312  into unicode from a member:
http://de.php.net/utf8_encode (gb2unicode in the lower bottom)

Unfortunatelly the required file is missing with the encoding. The post is also pretty old.

The question is how to get this chinese characters saved into a mysql db under utf-8 unicode?




--
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