필터 지우기
필터 지우기

Chinese word becomes messy code when using fastinsert for the MySql

조회 수: 1 (최근 30일)
Donghui  Sun
Donghui Sun 2014년 3월 26일
댓글: Walter Roberson 2014년 3월 26일
I need to read some records from a table in mysql and then write into another table.
First, I use the code to read records:
sql = 'select * ....';
cursor = fetch(exec(conn, sql));
The code can fetch the data, and the chinese field is very clearly. After this, I need to write the data into another table.
cursor{end+1} = 'test';
fastinsert(conn, tablename, colname, cursor);
The code can write the data into the specified table. BUT the chinese words become messy code. I don't know why.
What's more. I have tried:
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
So,I guess whether I need to do some character set relevant operations or not before insertion. And how to do it? :-)
Any suggestion will be thankful!
  댓글 수: 2
Walter Roberson
Walter Roberson 2014년 3월 26일
Could you show us the original encoding, and what it becomes? You could print in hex, such as
sprintf('%04x ', CharacterArray)

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Database Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by