From:             bubu at cc dot lv
Operating system: Windows 2000 SP4
PHP version:      5CVS-2004-11-08 (dev)
PHP Bug Type:     MySQLi related
Bug description:  utf8 chars are not correctly inserted into db

Description:
------------
In MySQL 4.1.7 version, any text in table with charset type UTF-8, are not
correctly inserted by mysqli_fetch_row function. UTF-8 text is inserted
into tables correctly. When looking in some mysql management tool (like
MySQL Control Center or MySQL Query Browser or command line mysql) all
text are displayed incorrectly. Executed in commandline INSERT command
correctly inserts utf-8 characters.

Reproduce code:
---------------
<?php
  $link = mysqli_connect('localhost', 'root', 'root', 'test');
  mysqli_query($link, "CREATE TABLE utf8_test(a CHAR(100)) CHARACTER SET
'utf8'");
  $text = '&#9472;ü&#9532;&#298;&#9532;å'; // any text non-ASCII text (in
UTF-8)
  mysqli_query($link, "INSERT INTO utf8_test VALUES ('$text')");
  $res = mysqli_query($link, "SELECT * FROM utf8_test");
  list($new_text) = mysqli_fetch_row($res);
  mysqli_free_result($res);
  mysqli_close($link);
  echo ($text == $new_text ? "TRUE" : "FALSE");
?>

Expected result:
----------------
TRUE

Actual result:
--------------
FALSE

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

Reply via email to