http://www.yces.chc.edu.tw/LifeType/post/1/118
如果有興趣要修改最新的 phpMyAdmin 能支援 Big5,可以參考以下的資料。
許多網頁介紹
使用 ContvertZ 轉換 chinese_traditional-utf-8.inc.php 成 chinese_traditional-big5.inc.php ,第一行改 $charset = 'big5';
vi libraries\select_lang.lib.php
$GLOBALS['mysql_charset_map'] = array(
'big5' => 'big5', //改為 latin1
'utf-8' => 'utf-8', //改為 latin1
但是程式裡面都沒有使用到 $GLOBALS['mysql_charset_map']
而且,SET CHARACTER SET 'utf8'; 已經固定寫死,參考以下程式碼
libraries\database_interface.lib.php
#852
if (! empty($GLOBALS['collation_connection'])) {
PMA_DBI_query("SET CHARACTER SET 'utf8';", $link, PMA_DBI_QUERY_STORE);
$mysql_charset = explode('_', $GLOBALS['collation_connection']);
PMA_DBI_query("SET collation_connection = '" . PMA_sqlAddslashes($GLOBALS['collation_connection']) . "';", $link, PMA_DBI_QUERY_STORE);
} else {
PMA_DBI_query("SET NAMES 'utf8' COLLATE 'utf8_general_ci';", $link, PMA_DBI_QUERY_STORE);
}
參考 2.x 版更改以上程式碼
$mysql_charset = $GLOBALS['mysql_charset_map'][$GLOBALS['charset']];
if (! empty($GLOBALS['collation_connection'])) {
PMA_DBI_query('SET CHARACTER SET ' . $mysql_charset . ';', $link, PMA_DBI_QUERY_STORE);
PMA_DBI_query("SET collation_connection = '" . PMA_sqlAddslashes($GLOBALS['collation_connection']) . "';", $link, PMA_DBI_QUERY_STORE);
} else {
PMA_DBI_query("SET NAMES '" . $mysql_charset . "' COLLATE 'utf8_general_ci';", $link, PMA_DBI_QUERY_STORE);
}
大功告成
以下是檢視 2 種版本 MySQL 連線差異
// VER 2.X
090506 9:16:01 1 Connect root@localhost on
1 Query SELECT VERSION()
1 Query SET NAMES latin1
1 Query SET collation_connection = 'utf8_unicode_ci'
1 Query SET CHARACTER SET latin1
1 Query SET collation_connection = 'utf8_unicode_ci'
1 Query SHOW SESSION VARIABLES LIKE 'collation_connection'
1 Query SHOW SESSION VARIABLES LIKE 'character_set_connection'
1 Query SHOW CHARACTER SET
1 Query SHOW COLLATION
1 Quit
2 Connect root@localhost on
2 Query SELECT VERSION()
2 Query SET NAMES latin1
2 Query SET collation_connection = 'utf8_unicode_ci'
2 Query SET CHARACTER SET latin1
2 Query SET collation_connection = 'utf8_unicode_ci'
2 Query SHOW SESSION VARIABLES LIKE 'collation_connection'
2 Query SHOW SESSION VARIABLES LIKE 'character_set_connection'
2 Query SHOW CHARACTER SET
2 Query SHOW COLLATION
2 Query SHOW DATABASES
2 Query SHOW TABLES FROM `information_schema`
2 Query SHOW TABLES FROM `mysql`
2 Query SHOW TABLES FROM `test`
2 Quit
090506 9:16:02 3 Connect root@localhost on
3 Query SELECT VERSION()
3 Query SET NAMES latin1
3 Query SET collation_connection = 'utf8_unicode_ci'
3 Query SET CHARACTER SET latin1
3 Query SET collation_connection = 'utf8_unicode_ci'
3 Query SHOW SESSION VARIABLES LIKE 'collation_connection'
3 Query SHOW SESSION VARIABLES LIKE 'character_set_connection'
3 Query SHOW CHARACTER SET
3 Query SHOW COLLATION
3 Query SELECT COUNT(*) FROM mysql.user
3 Query SELECT COUNT(*) FROM mysql.user
3 Query SHOW GRANTS
3 Query SELECT COUNT(*) FROM mysql.user
3 Query SELECT USER()
3 Query SHOW MASTER LOGS
3 Quit
//ver 3.x
090506 9:16:50 4 Connect root@localhost on
4 Query SET CHARACTER SET 'utf8'
4 Query SET collation_connection = 'utf8_unicode_ci'
4 Quit
5 Connect root@localhost on
5 Query SET CHARACTER SET 'utf8'
5 Query SET collation_connection = 'utf8_unicode_ci'
5 Query SHOW DATABASES
5 Query SHOW TABLES FROM `information_schema`
5 Query SHOW TABLES FROM `mysql`
5 Query SHOW TABLES FROM `test`
5 Quit
090506 9:16:51 6 Connect root@localhost on
6 Query SET CHARACTER SET 'utf8'
6 Query SET collation_connection = 'utf8_unicode_ci'
6 Init DB mysql
6 Query SHOW MASTER LOGS
6 Query SELECT USER()
6 Quit
[ 發表回應 ] ( 10預覽 ) | 常註連結 | ( 2.9 / 1776 )