Re: Greek Characters from MySQL to PHP to the Browser: ??????

From: Date: Wed, 09 Aug 2006 00:24:24 +0000
Subject: Re: Greek Characters from MySQL to PHP to the Browser: ??????
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-240349@lists.php.net to get a copy of this message
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; - wrap output in htmlentities() --> echo htmlentities($greek_string, ENT_NOQUOTES, 'UTF-8'); - wrap output in utf8_decode() --> echo utf8_decode($greek_string); - 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? Thanks in advance, John W Can't you set PHP's internal encoding to utf8...
; language for internal character representation. mbstring.language = utf8 -- life is a game... so have fun.

« previous php.general (#240349) next »