ID:              42297
 User updated by: bmilosavljevic at gmail dot com
 Reported By:     bmilosavljevic at gmail dot com
 Status:          Open
 Bug Type:        MySQL related
 PHP Version:     4.4.7
 New Comment:

I think I 've found the solution! This bug is due to MySQL, I think. If
the following sql query is executed: SET CHARACTER SET utf8 (without ;
is recommended)
immediately after establishing a connection, the problem is solved, at
least for me! Even more suitable query would be SET NAMES utf8, because
connection's query strings are also submitted to the server in utf8.
<?php
$link = mysql_connect('localhost', 'database_username',
'database_user_pwd');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
if (!mysql_select_db('database_name', $link)) {
echo 'Could not select database';
exit;
}

//could be also SET NAMES utf8
$sql = 'SET CHARACTER SET utf8';
$result = mysql_query($sql, $link);
...
?>
and instead of ... any query executed should return proper utf8
characters. Check this please in your environment!


Previous Comments:
------------------------------------------------------------------------

[2007-09-24 14:10:44] dev at unleashedmind dot com

Confirming that this bug exists.

------------------------------------------------------------------------

[2007-08-14 16:07:27] bmilosavljevic at gmail dot com

Description:
------------
mysql_fetch functions return question marks (?) instead of utf8 chars
(other than latin1). Tested on linux production server and on local
windows developer server as well.



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=42297&edit=1

Reply via email to