Differences between revisions 1 and 2
Revision 1 as of 2006-10-23 11:14:14
Size: 1287
Editor: ZoomQuiet
Comment:
Revision 2 as of 2006-10-23 11:14:38
Size: 1243
Editor: ZoomQuiet
Comment:
Deletions are marked like this. Additions are marked like this.
Line 4: Line 4:
KAD 支持 KAD 支持-UTF8
Line 8: Line 8:
## 默许导航,请保留
[[Include(CPUGnav)]]

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整理声明:

attachme:mysql-UTF8-tab_681x183_scrot.png

  1. HTML 页面声明:

    <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
  2. 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)