funny blobs



hi -

i think from code snippets on the web i put a ms word doc in
a db table. if i encode i get printable ascii. if i decode i get
funny symbols.

how do you read the data in the db table if it comes out binary
decoded?

right now i think my last tk_messageBox is printing out
the ascii character for either decode or encode but that
doesnt tell me the characters that are typed into the word
ms doc file. in the doc file i may have typed
the words "funny blob test".

it seems you must be able to read the contents of that stored
file in the db table or it doesnt make much sense.

i read in fancy sqlite managers they even have the capability
to edit a blob. so that is proof to me that they can at least
read the data. changing it is another story....

thanks for any help,
jim

package require base64


set myFile c:/Tcl/bin/binWord.doc

# ---- open and read file ----
set myFP [ open $myFile r ]
fconfigure $myFP -translation binary


set {pure file} [ read $myFP ]


# ---- encode ----
#set {encoded file} [ ::base64::encode ${pure file} ]



package require sqlite3
sqlite db3 c:/Tcl/bin/db3

db3 eval "
CREATE TABLE blobs(
blob_id TEXT PRIMARY KEY,
blob BLOB
);"

sqlite db3 c:/Tcl/bin/db3
db3 eval "insert into blobs
(blob_id, blob)
values (1,'[::base64::encode ${pure file}]')"

set binary_data [base64::decode [db3 eval "
select blob from blobs where blob_id = 1"]]

tk_messageBox -message [::base64::encode ${pure file}]

binary scan [::base64::encode ${pure file}] "ccc" a b c
set c
tk_messageBox -message $b


db3 close
close $myFP


.



Relevant Pages

  • Re: Does anyone know if BerConverter class runs on Win 2000 server
    ... IMO your encode blob is not valid. ... When I decode your blob on XP SP2 or W2K3 I get: ... The meetingBlob property was encoded in my C++ application. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: How to exchange keys C++ <-> Java ?
    ... Note that the PublicKey member blob is itself also encoded. ... I don't think it is possible to encode directly from a PUBLICKEYBLOB (or CryptoAPI key handle) ...
    (microsoft.public.platformsdk.security)
  • Re: How to exchange keys C++ <-> Java ?
    ... >To get an encoded SubjectPublicKeyInfo file blob, ... >Note that the PublicKey member blob is itself also ... >encode it using: ... PUBLICKEYBLOB ...
    (microsoft.public.platformsdk.security)