Differences between revisions 3 and 4
Revision 3 as of 2006-10-23 11:15:07
Size: 1248
Editor: ZoomQuiet
Comment:
Revision 4 as of 2006-10-23 11:15:32
Size: 1250
Editor: ZoomQuiet
Comment:
Deletions are marked like this. Additions are marked like this.
Line 30: Line 30:
 attachmt:mysql-UTF8-tab_681x183_scrot.png  attachment:mysql-UTF8-tab_681x183_scrot.png

KAD 支持-UTF8 ::-- ZoomQuiet [DateTime(2006-10-23T11:14:14Z)] TableOfContents

1. LAMPs-UTF8解决

1.1. 从GB2312解放出来

参考:http://www.9ycer.com/?p=18 进行数据库升级

  1. 导出SQL文件
  2. 转换SQL编码:
    • iconv -t utf-8 -f gb2312 -c old.sql > UTF.sql

  3. 重新导入DB:

{{{# 创建目标DB 使用对应整理 mysql> CREATE DATABASE IF NOT EXISTS my_database default charset utf8 COLLATE utf8_general_ci; }}}

  • 修改;增加一条sql语句: “SET NAMES utf8;“
  • 倒入: mysql -h localhost -u root -p my_database < UTF.sql

1.2. 确认

  1. 确认DB整理声明: attachment:mysql-UTF8-db_595x269_scrot.png
  2. 确认TABLE整理声明: attachment:mysql-UTF8-tab_681x183_scrot.png
  3. HTML 页面声明:

    <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
  4. PHP 数据库连接编码:

    $dblink = MYSQL_CONNECT(dbHostname, dbUsername, dbPassword) OR DIE("Error !! Unable to connect to database");       
    @mysql_select_db(dbName) or die( "Unable to select database ".dbName); 
    mysql_query("set names 'utf8'"); 


DONE! 完成从 GB 真正全部转化为UTF8!

2. 反馈

ZoomQuiet/2006-10-23 (last edited 2009-12-25 07:10:23 by localhost)