VBScript String Conversion
Posted on 2000-05-11
I'm running into a strange block, and I need some help. I want ot store .doc files in a database as blob fields, and I have ADO figured out sufficiently to do this. My problem is in reading the file initially from the hard disk, and writing it later after I retrieve it again from the database.
Using Open <filename> for binary as #1, I never have any problems; I can read and write a Word 2000 document with no trouble as a byte array, preserving integrity as I go. I also save the space in the database by writing an ascii style byte array, rather than a unicode twobyte system.
I would really like to write this as a VBScript file, for ease of modification purposes. Unfortunately, VBScript does not support the Open statement, so I tried to use the Scripting.FileSystemObject. THis seems to read files fine, whether as ascii or unicode, into byte arrays. The only way I can use the FileSystemObject to write, however, is to use Strconv to push the ascii blob back into a unicode format that the FileSystemObject can write properly. If I don't, it writes garbage. My biggest problem is that Microsoft has eliminated StrConv from it's list of supported functions for VBScript!!
I have tried writing the full unicode byte array to the database, and I have no trouble, other than that it takes up twice as much room. I really want ot be able to send it as ascii.
Can anyone suggest a solution?