MySQL編碼問題 |
發(fā)布時間: 2012/9/5 17:17:13 |
查看MySQL當前編碼情況: mysql> show variables like \'%character%\'; +--------------------------+----------------------------+ | Variable_name | Value |-
| character_set_client | latin1 | | character_set_connection | latin1 | | character_set_database | latin1 | | character_set_filesystem | binary | | character_set_results | latin1 | | character_set_server | latin1 | | character_set_system | utf8 | | character_sets_dir | /usr/share/mysql/charsets/ | +--------------------------+----------------------------+ 修改為utf8編碼:修改/etc/my.cnf 在[client]下增加default-character-set=utf8 在[mysqld]下增加character_set_server=utf8 重新查看編碼情況: mysql> show variables like 'character%'; 如此修改后,JDBC訪問不會出現(xiàn)亂碼。 注意JSP頁面編碼也要寫成UTF-8.
本文出自:億恩科技【mszdt.com】 |