ID: 31176
Updated by: [EMAIL PROTECTED]
Reported By: list at bgp5 dot net
-Status: Open
+Status: Feedback
Bug Type: MySQL related
Operating System: RH 9 & FC3
PHP Version: 4.3.10
New Comment:
How did you escape the data on insert?
Previous Comments:
------------------------------------------------------------------------
[2004-12-18 06:14:42] list at bgp5 dot net
Description:
------------
Hi,
The web browser display the following characters correctly, however PHP
unable to insert the characters properly into MySQL. I am using the
latest MYSQL 4.1.7 and I have checked with MySQL, that their engine
able to support utf8 and I have configured with charset=utf8.
These are the characters:
面
浏
荐
MySQL table displays after insert via PHP:
�?�
�?
�??
Table description:
ENGINE=MyISAM DEFAULT CHARSET=utf8
It seems like PHP cannot insert certain symbol.
Reproduce code:
---------------
Insert the following characters through web using PHP into mysql table
with Form charset utf8:
面
浏
荐
Try this simple code, copy and paste the characters, it doesn't work
for me.
The table still displays question mark "??".
<html>
<meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\">
<form accept-charset=utf-8 method=post action="">
<textarea name=ta cols=28 rows=6></textarea>
<input type=submit>
</form>
</html>
<?php
$data = $HTTP_POST_VARS['ta'];
echo "<br><br>characters: $data";
$conn = mysql_connect("localhost", "root", "test") or
die(mysql_error());
mysql_select_db('bug', $conn) or die(mysql_error());
$q = "INSERT into bug (message) values ('$data')";
mysql_query($q, $conn);
?>
Expected result:
----------------
Input these characters:
面
浏
荐
MySQL table displays after insert via PHP:
�?�
�?
�??
Actual result:
--------------
Input these characters:
面
浏
荐
MySQL table should display after insert via PHP:
面
浏
荐
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=31176&edit=1