LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Selecting Chinese from mysql error:It only returns half of the total length

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!

0 Kudos
Message 1 of 4
(2,493 Views)

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.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 2 of 4
(2,463 Views)

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?

 

 

 

 

0 Kudos
Message 3 of 4
(2,439 Views)

Are you using database varient to data for conversion?

--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
0 Kudos
Message 4 of 4
(2,434 Views)