以前的mantis是保存为utf8编码的,转移数据库后,就变成了乱码了(都是?号)。
解决方法(maybe ugly:-)):修改core/database_api.php文件,在db_query方法中,增加两句:
$g_db->Execute(“SET NAMES UTF8”);
使得db_query方法变为如下所示:
# ——————–
# execute query, requires connection to be opened
# If $p_error_on_failure is true (default) an error will be triggered
# if there is a problem executing the query.
function db_query( $p_query, $p_limit = -1, $p_offset = -1 ) {
global $g_queries_array, $g_db;
$t_start = microtime_float();
if ( ( $p_limit != -1 ) || ( $p_offset != -1 ) ) {
$g_db->Execute(“SET NAMES UTF8”);
$t_result = $g_db->SelectLimit( $p_query, $p_limit, $p_offset );
} else {
$g_db->Execute(“SET NAMES UTF8”);
$t_result = $g_db->Execute( $p_query );
}
$t_elapsed = number_format( microtime_float() – $t_start, 4);
array_push ( $g_queries_array, array( $p_query, $t_elapsed ) );
if ( !$t_result ) {
db_error($p_query);
trigger_error( ERROR_DB_QUERY_FAILED, ERROR );
return false;
} else {
return $t_result;
}