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

2006-08-10 Thread John Wells

Thanks to everybody's suggestions, problem solved.  Yes, the default
encoding for PHP's mysql client is latin1.  So a quick query of:

SET NAMES 'utf8'

*per connection* works it all out.

The articles and links were very helpful in alluminating some of the
other particulars of working with utf-8.  These will take a bit more
reading and studying...

Thanks to all!

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



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

2006-08-08 Thread Jochem Maas
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?

odds are your not specifying a charset for the connection ... and that the 
default
connection charset is ISO-8859-1 (known as Latin1 in MySQL iirc).

try running these 2 queries after you connect to the DB (might not work, it 
depends on
on MySQL version):

$CharSet = 'UTF-8';
$qry1 = SET NAMES '{$CharSet}');
$qry2 = SET CHARACTER SET {$CharSet};



 
 Thanks in advance,
 John W
 

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



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

2006-08-08 Thread Richard Lynch
On Tue, August 8, 2006 10:27 am, John Wells wrote:
 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.

I would guess that the MySQL client linked into PHP isn't UTF-8, and
it keeps asking the MySQL server to switch to Latin1...

You may find this blog post worth reading:
http://www.oreillynet.com/onlamp/blog/2006/01/turning_mysql_data_in_latin1_t.html

-- 
Like Music?
http://l-i-e.com/artists.htm

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



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

2006-08-08 Thread Ligaya Turmelle

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.

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