Commit d96be836 authored by Steven Wittens's avatar Steven Wittens

- #40515: MySQL UTF-8 conversion fixes

parent dcb092e6
......@@ -1491,10 +1491,11 @@ function _system_update_utf8($tables) {
}
// See if database uses UTF-8 already
$url = parse_url($GLOBALS['db_url']);
global $db_url;
$url = parse_url(is_array($db_url) ? $db_url['default'] : $db_url);
$db_name = substr($url['path'], 1);
list(, $create) = db_fetch_array(db_query('SHOW CREATE DATABASE `%s`', $db_name));
if (preg_match('/utf8/i', $create)) {
$result = db_fetch_array(db_query('SHOW CREATE DATABASE `%s`', $db_name));
if (preg_match('/utf8/i', array_pop($result))) {
return array();
}
......
......@@ -83,12 +83,6 @@ function db_connect($url) {
/* On MySQL 4.1 and later, force UTF-8 */
if (version_compare(mysql_get_server_info(), '4.1.0', '>=')) {
mysql_query('SET NAMES "utf8"', $connection);
mysql_query('SET collation_connection="utf8_general_ci"', $connection);
mysql_query('SET collation_server="utf8_general_ci"', $connection);
mysql_query('SET character_set_client="utf8"', $connection);
mysql_query('SET character_set_connection="utf8"', $connection);
mysql_query('SET character_set_results="utf8"', $connection);
mysql_query('SET character_set_server="utf8"', $connection);
}
return $connection;
}
......
......@@ -79,12 +79,6 @@ function db_connect($url) {
/* Force UTF-8 */
mysqli_query($connection, 'SET NAMES "utf8"');
mysqli_query($connection, 'SET collation_connection="utf8_general_ci"');
mysqli_query($connection, 'SET collation_server="utf8_general_ci"');
mysqli_query($connection, 'SET character_set_client="utf8"');
mysqli_query($connection, 'SET character_set_connection="utf8"');
mysqli_query($connection, 'SET character_set_results="utf8"');
mysqli_query($connection, 'SET character_set_server="utf8"');
/**
* from: http://bugs.php.net/bug.php?id=33772
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment