我需要从mysql的一个表中读取一些记录,然后写入另一个表。
首先,我使用代码来读取记录:
sql = 'select * ....';
cursor = fetch(exec(conn, sql));代码可以获取数据,中文字段非常清晰。在此之后,我需要将数据写入另一个表。
cursor{end+1} = 'test';
fastinsert(conn, tablename, colname, cursor);代码可以将数据写入指定表。但是,中文单词变成了混乱的代码。我也不知道原因。
更重要的是。我试过了:
1) insert a record using phpmyadmin manually, and the chinese word is clearly.
2) change the default character set of mysql to 'utf-8',but the error exists as well所以,我猜测在插入之前是否需要做一些字符集相关的操作。怎么做呢?:-)
任何建议都将不胜感激!
发布于 2014-03-28 12:44:28
我已经弄清楚这个问题了。
1) set the mysql charset utf8
set names 'utf8'
2) specify the matlab connection charset ''utf8''
append useUnicode=true&charset=utf8 on the database urlhttps://stackoverflow.com/questions/22682294
复制相似问题