BLOBStream and Codepage problem lazarus / 8-Other ---------------------------------------------------------------------- piper62 ยท 2007-12-08 16:47 Hello, I have a problem with a BlobSteream. Environment is: Debian Linux (Etch), FPC 2.0.4, Lazarus 0.9.20 and ZeosLib 6.6.1 (stable). The purpose is to store files in a blob field a table. The code below worked perfectly with any type of files. Also the size of the files was no problem. -If we pay attention to the MySQL settings. We changed the ZConnection properties to "codepage=utf8" to solve our codepage problems. But now I have the problem that the writing of the blobs to the database generates buggy files. The read out is no problem. There the codepage doesn't effect the files. Also the filesize is different, I get smaller files if I switch "codepage=utf8" on. -FileStream.Size is not the problem. I get the same size information, independent from codepage setting. here's the code: ---------------------------------------------------------------------- ---------- ZQuery1.Append; BlobStream := ZQuery1.CreateBlobStream(ZQuery1.FieldByName('image'), bmWrite); try FileStream := TFileStream.Create(Opendialog1.FileName, fmOpenRead); try BlobStream.CopyFrom(FileStream, FileStream.Size); finally FileStream.Free; end; finally BlobStream.Free; end; ---------------------------------------------------------------------- ---------- At the moment I make a workaround by clearing the properties on the ZConnection, then writing the blob field and resetting it after the commit. Then I have to locate the inserted record and fill in the textfields of the table. Because if I do that during insert I have wrong text due to the wrong codepage... I don't like this solution but it works. has anybody an explanation why to write the Stream doesn't work with utf8 ? As I mentioned, reading the stream is no problem. Has somebody an idea? I posted this message also on the Zeoslib forum. Regards, Tibor