|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits              [2004-12-21 15:43 UTC] iliaa@php.net
  [2004-12-29 01:00 UTC] php-bugs at lists dot php dot net
 | |||||||||||||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 02:00:02 2025 UTC | 
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: 面 浏 荐