Prev: DB Editor
Next: rtf to HTML
From: Ginny Caughey on 6 Dec 2009 19:39 I ran into the same thing, Geoff. Here's the code from my Start method: SetAnsi(TRUE) // needed for saving/displaying signatures I haven't had any issues with binary data since then. -- Ginny Caughey www.wasteworks.com "Geoff Schaller" <geoffx(a)softxwareobjectives.com.au> wrote in message news:1YXSm.60744$ze1.54359(a)news-server.bigpond.net.au... > I've found the bug - it is in MemoWrit() > Try this: > > cValue := MemoRead("C:\temp\g1.jpg") > MemoWrit("c:\temp\g2.jpg", cValue) > > Substitute in any jpg name you wish and whilst MemoRead correctly reads > binary data into a string, that data is not correctly written back out. > It's something to do with ANSI to OEM conversion. > > Cheers, > > Geoff > > > "Geoff Schaller" <geoffx(a)softxwareobjectives.com.au> wrote in message > news:IJMSm.60622$ze1.12861(a)news-server.bigpond.net.au: > >> Using VO2Ado. >> >> I am saving binary data perfectly into a SQL table but when I read it >> back it is being corrupted. For example: >> >> uValue := oServer:Fieldget(BINDATA) >> >> // this correctly gives me an object of type AdoLongBinary >> >> cValue := uValue:Value >> >> The cValue is "almost" correct but there are some characters which are >> inverted or changed. >> Does anyone know what I am talking about here? >> >> Regards, >> >> Geoff Schaller >
From: Geoff Schaller on 6 Dec 2009 19:42 I have had to use SetAnsi(TRUE) and I can then still use memowrit. There is information in the Help on this but I wasn't expecting the effect. Geoff
From: Geoff Schaller on 6 Dec 2009 19:43 I think we posted at the same time <g> That is what I've now found.... Thanks. "Ginny Caughey" <ginny.caughey.online(a)wasteworks.com> wrote in message news:007a8d64$0$16940$c3e8da3(a)news.astraweb.com: > I ran into the same thing, Geoff. Here's the code from my Start method: > > SetAnsi(TRUE) // needed for saving/displaying signatures > > I haven't had any issues with binary data since then. > > -- > > Ginny Caughey > www.wasteworks.com
From: Malcolm on 7 Dec 2009 08:28
Geoff Schaller wrote: > I've found the bug - it is in MemoWrit() > Try this: > > cValue := MemoRead("C:\temp\g1.jpg") > MemoWrit("c:\temp\g2.jpg", cValue) > > Substitute in any jpg name you wish and whilst MemoRead correctly reads > binary data into a string, that data is not correctly written back out. > It's something to do with ANSI to OEM conversion. Given that the help says ==== Some characters, such as "�," have different ANSI and OEM codes. When writing such characters from Windows to a file, you may need to issue the Ansi2Oem() function. Conversely, when reading the file back to Windows, you may need to issue an Oem2Ansi() function. To circumvent such problems, MemoWrit() automatically does an ANSI to OEM conversion when SetAnsi() is FALSE. MemoRead() reads a disk file into memory, where it can be manipulated as a string or assigned to a memo field. MemoRead() is used with MemoEdit() and MemoWrit() to edit an imported disk file; then write it back to disk. This [memoread] function does an automatic OEM to ANSI conversion when SetAnsi() is FALSE. ==== i would never use either with binary data with setansi false (as oem2ansi is lossy) |