Malformed trail byte error

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
dbulic
Posts: 3
Joined: Thu 05 Feb 2009 10:45

Malformed trail byte error

Post by dbulic » Tue 04 Oct 2011 07:28

When I try to open a table containing binary value using TMyQuery, exception is raised with a message 'malformed trail byte'.
In the stack trace I can see that you are trying to transform binary data from UTF8 to WideString, which doesn't make any sense.
Stack trace goes: TMySQLRecordset.Fetch, ProcessRow, GetDataFromRow, ConvertToWideString, Utf8ToWS.

Here is how to recreate the problem:

create table `Address`(
`AddressID` int not null,
`rowguid` binary(16) not null
);
insert into `Address`(`AddressID`,`rowguid`) values (1,0x9AADCB0D36CF483F84D8585C2D4EC6E9);

AndreyZ

Post by AndreyZ » Wed 05 Oct 2011 13:28

To solve the problem, you should set the TMyQuery.Options.BinaryAsString option to False. For more information about this option, please refer to the MyDAC documentation.

Post Reply