Re: [PHP-DB] PHP/MySQL UTF-8 SNAFU

2007-07-13 Thread OKi98

Charles Sheinin napsal(a):
Ok, so I have a fully UTF-8 MySQL database with a fully UTF-8 table. I 
have a php page which has meta http-equiv=content-type 
content=application/xhtml+xml; charset=utf-8 / at the top of the 
html section and mysql_set_charset(utf8); after my connection 
(it's php 2.2.3, so that's more or less the same as mysql_query(SET 
NAMES 'utf8');/(SET SESSION character_set_client = utf8);, though 
I tried all that too, anyway).  I have all my php.ini mbstring stuff 
configured for utf-8:


mbstring.language = Neutral
mbstring.internal_encoding = UTF-8
mbstring.http_input = auto
mbstring.encoding_translation = On
mbstring.detect_order = auto

and for what it's worth, echo mb_internal_encoding(); reports UTF-8.

when I run a query that pulls out (in this case, Japanese, but say 
any) UTF8 data, it displays properly in MySQL Query Browser.  With php 
in the above context however, it does not.  Instead, it prints a ? 
corresponding to each character.  When I use mb_detect_encoding(); on 
each such string, it tells me they are encoded as ASCII.  The nearest 
I can tell is that somewhere between using mysql_query() and 
mysql_fetch_row(), things got messed up.  Is this a bug?  Is there 
something I'm missing?  Any clues? Help!



do you have

*meta http-equiv=Content-Type content=text/html; charset=utf-8*

header in your script?

OKi98

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



[PHP-DB] PHP/MySQL UTF-8 SNAFU

2007-07-12 Thread Charles Sheinin
Ok, so I have a fully UTF-8 MySQL database with a fully UTF-8 table. I have 
a php page which has meta http-equiv=content-type 
content=application/xhtml+xml; charset=utf-8 / at the top of the html 
section and mysql_set_charset(utf8); after my connection (it's php 
2.2.3, so that's more or less the same as mysql_query(SET NAMES 
'utf8');/(SET SESSION character_set_client = utf8);, though I tried all 
that too, anyway).  I have all my php.ini mbstring stuff configured for 
utf-8:


mbstring.language = Neutral
mbstring.internal_encoding = UTF-8
mbstring.http_input = auto
mbstring.encoding_translation = On
mbstring.detect_order = auto

and for what it's worth, echo mb_internal_encoding(); reports UTF-8.

when I run a query that pulls out (in this case, Japanese, but say any) UTF8 
data, it displays properly in MySQL Query Browser.  With php in the above 
context however, it does not.  Instead, it prints a ? corresponding to each 
character.  When I use mb_detect_encoding(); on each such string, it tells 
me they are encoded as ASCII.  The nearest I can tell is that somewhere 
between using mysql_query() and mysql_fetch_row(), things got messed up.  Is 
this a bug?  Is there something I'm missing?  Any clues? Help!


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



Re: [PHP-DB] PHP/MySQL UTF-8 SNAFU

2007-07-12 Thread Niel
Hi

What functions are you using?  Many of PHP's functions are not multibyte
aware and default to ASCII.  I had this problems myself end of last year.
--
Niel Archer

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