From:             jhala at uoregon dot edu
Operating system: Vista/Fedora 7/WinXP
PHP version:      5.2.3
PHP Bug Type:     MySQL related
Bug description:  utf8 data appears to become ascii after 
mysql_query/mysql_fetch_row

Description:
------------
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.  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" and
mysql_client_encoding(); reports "utf8".


Reproduce code:
---------------
$con = mysql_connect('localhost', 'user', 'password');
mysql_select_db("database", $con);
mysql_set_charset("utf8");

$query = "SELECT japanese_terms.term_lang, language_en FROM
japanese_terms, languages ";
$query .="WHERE japanese_terms.term_id = languages.language_id ORDER BY
term_id";
$result = mysql_query($query);
while( $row = mysql_fetch_row($result))
{
  foreach($row as $field)
    { print($field . "<br />"); }
}

Expected result:
----------------
I expect the UTF-8 data to display properly, and as UTF-8 data.  When I
run the same query that pulls out (in this case, Japanese, but say any)
UTF8 data, it displays properly in MySQL Query Browser.

Actual result:
--------------
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" instead of
expected "UTF-8".

-- 
Edit bug report at http://bugs.php.net/?id=41957&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=41957&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=41957&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=41957&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=41957&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=41957&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=41957&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=41957&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=41957&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=41957&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=41957&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=41957&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=41957&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=41957&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=41957&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=41957&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=41957&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=41957&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=41957&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=41957&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=41957&r=mysqlcfg

Reply via email to