I had a problem yesterday in transferring some old information to the new database system. The default charset for the old system is 'latin1' , while in the new system it is set to 'utf8'. after I used simple sql query
"INSERT INTO some_tbla (x1,x2) SELECT x11,x21 FROM some_tblb"
all multiple bytes characters in the target table became "?????".
这显然是字符编码的问题。原来的latin1或者其他编码的字符需要转换成utf8的。
Using 'ICONV' extension of PHP will be helpful ,something like this:
$str_converted = iconv('gbk','utf8',$str_need_convertion).
then,insert the converted strings into the new table ,everything goes well!
Feb 1, 2007
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment