09-10-2013 03:36 AM
When the record in the table is "中国好声音“,(its English meaning is" Voice of China"), it just returns”中国?“,and if the record is”方文山方文山“,it just returns ”方文山",it aways returns half of the total length when the record is Chinese. But when the reocrd is English, the result is correct.
I use Labview 7.1, MySQL 5.0, and LabSQL. I tried using charset of both GB2312 and UTF-8 in MySQL, it returns the same result.
Hoping I can get some help from here, thanks very much!
09-10-2013 01:21 PM
Seems like somewhere in the LabVIEW - MySQL path there is a mixup between data length in byte and character length. Since Chinese characters don't fit into 8 bit codes they will use up more space than one byte, how much depends on the actual storage format such as UTF8 or UTF16 but it is safe to assume that it will be at least 2 bytes per character or more.
So at some point the SQL interface probably queries the length of the retured data which is given in characters and then the data query is done in bytes with that number which only copies part of the actual data. You will likely have to did into the LabSQL VIs down to the lowest level to see where the mixup could be. It could even be a bug in the MyODBC connector or whatever MySQL ODBC or ADO driver you are using.
09-16-2013 01:49 AM
Hi Rolf ,
Thanks very much for your reply.
I didn't find where the mixup is, if it is really "a bug in the MyODBC connector or whatever MySQL ODBC or ADO driver“,what else way could be replaced to solve the problem as I must use MySQL?
09-16-2013 02:31 AM
Are you using database varient to data for conversion?