John Wells wrote:
Hi Everybody,

Despite all of my Googling and noodling, I can't seem to figure this
out, and am hoping someone might be able to point me in the right
direction.

Scenario:
- Running Apache 1.3 on OSX 10.4, PHP 5.1.4, MySQL 5.0.19
- Greek text is stored in a MySQL database, encoding set to UTF-8
- From within a db admin like CocoaMySQL, the greek text looks normal
- PHP queries the db table for the greek text
- no matter how I echo the text to screen (see below), it only
produces '?????' marks

What I've tried:
- force utf-8 headers to be sent  ---> header("Content-type:
text/html; charset=UTF-8");
- indicate utf-8 in the meta tag --> <meta http-equiv=Content-Type
content="text/html; charset=utf-8" />
- simpley echo the string as is --> echo $greek_string;

The above should be correct!

- wrap output in htmlentities() --> echo htmlentities($greek_string,
ENT_NOQUOTES, 'UTF-8');
- wrap output in utf8_decode() --> echo utf8_decode($greek_string);

Neither of the above should be used.

- If I copy and paste greek characters from the db table into a string
in my PHP script, and output that, it works just FINE, without any
htmlentities() or other functions.

I'm at a loss.  What am I doing wrong?

That I don't know :)

I'm guessing that there may be some setting inbetween the PHP and mysql layer that is mangling things.

You may need to setup the character set used for the communication between mysql and PHP.

Have a look on this page, and the comments on it. Perhaps you need to do something like in comment 2??

http://uk2.php.net/manual/en/function.mysql-client-encoding.php


Col

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

Reply via email to