ID: 35183
Updated by: [EMAIL PROTECTED]
Reported By: lzx21cn at 21cn dot com
-Status: Open
+Status: Feedback
Bug Type: MySQL related
Operating System: linux debian unstable
PHP Version: 4.4.1
New Comment:
Try to do the same without PHP (using the console interface of MySQL)
and see if it works this way.
If it does, put the code somewhere in the Net and paste the link here,
so the Unicode data won't be corrupted by the bug system.
Also add the expected and actual results, I doubt I can guess them
myself.
And try to explain why do you think it's a problem of PHP, not MySQL or
something else (I'd be glad if you try to use something close to English
to do that).
Previous Comments:
------------------------------------------------------------------------
[2005-11-11 16:41:04] lzx21cn at 21cn dot com
sorry, 1st comment file is error
This is you need php file (utf8)
----------------------
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<?php
$connect=mysql_connect("localhost","kevin","");
$select=mysql_select_db("kevin",$connect);
$query="insert into test1 values (2,\"å大ç空\");";
$result=mysql_query($query);
$result=mysql_query("select * from test1;");
mysql_close();
?>
------------------------------------------------------------------------
[2005-11-11 16:34:31] lzx21cn at 21cn dot com
you need php file (utf8)
----------------------
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<?php
$connect=mysql_connect("localhost","kevin","");
$select=mysql_select_db("kevin",$connect);
$query="insert into test1 values (2,\"å大ç空\");";
$result=mysql_query($query);
$result=mysql_query("select * from test1;");
$rows=mysql_num_rows($result);
for ($i=0;$i<$rows;$i++)
{
$a=mysql_fetch_array($result);
echo "第ä¸ä¸ªå段æ¯ï¼".$a[0]." | ";
echo "第äºä¸ªå段æ¯ï¼".$a[1]."<br>";
}
mysql_close();
?>
------------------------------------------------------------------------
[2005-11-10 17:24:09] [EMAIL PROTECTED]
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves.
A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external
resources such as databases, etc.
If possible, make the script source available online and provide
an URL to it here. Try to avoid embedding huge scripts into the report.
------------------------------------------------------------------------
[2005-11-10 16:36:28] lzx21cn at 21cn dot com
Description:
------------
write in mysql by utf8
it is wrong!
Reproduce code:
---------------
1.modify php.ini
...
mbstring.internal_encoding = UTF-8
mbstring.http_output = UTF-8
mbstring.detect_order = UTF-8
2. php file (utf8)
$sql="insert into test1 values(2,'å大ç空');";
mysql_query($sql);
Expected result:
----------------
*record where id=1 is inputed in gnome-terminal
---- command: mysql IN gnome-terminal (utf8) ----
select * from test1;
id | name
1 | ç大欢å
2 | å大ç空
--------------------------------------------------
Actual result:
--------------
---- command: mysql IN gnome-terminal (utf8) ----
select * from test1;
id | name
1 | ç大欢å
2 | (something character which I unknow)
--------------------------------------------------
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=35183&edit=1