2009年12月18日 星期五

MySQL big5轉utf8編碼

mysqldump -uroot -p --default-character-set=latin1 nfspc >nfspc.sql
mysqldump -uroot -p --default-character-set=latin1 pigfather >pigfather.sql

piconv -f big5 -t utf8 nfspc.sql >nfspc_utf8.sql
piconv -f big5 -t utf8 pigfather.sql >pigfather_utf8.sql

vi nfspc_utf8.sql

SET NAMES utf8;
SET CHARACTER_SET_CLIENT=utf8;
SET CHARACTER_SET_RESULTS=utf8;

:1,$s/DEFAULT CHARSET=latin1/DEFAULT CHARSET=utf8/g
:1,$s/latin1/utf8/gc
:1,$s/許\\/許/g
:1,$s/功\\/功/g
:1,$s/蓋\\/蓋/g
:1,$s/餐\\/餐/g
:1,$s/愧\\/愧/g
:1,$s/擺\\/擺/g
:1,$s/穀\\/穀/g
:1,$s/淚\\/淚/g
:1,$s/豹\\/豹/g
:1,$s/珮\\/珮/g


mysql -uroot -p nfspc < nfspc_utf8.sql
mysql -uroot -p pigfather < pigfather_utf8.sql

摘自:http://tw.myblog.yahoo.com/d89413125/article?mid=70&prev=74&next=62

沒有留言:

wibiya widget