Jaa


 getting inserted before the base64 encoded representation of the binary data of GIF image

When an application is creating a CDO[6.5.6756.0] Message and inserting a BodyPart of the type GIF image, and the base64 encoded representation of the binary data is initialized to the body part as shown below:
Const c_Base64Sample = "R0lGODlhEAAOAPcAAAAAAIAAAACAAICAAAAAgIAAgACAgICAgMDAwP8AAAD/AP//AAAA//8A/wD"

sFile = "sample.gif"
sContentType = "image/gif"
Set iPartAttach = iPartBody.AddBodyPart
iPartAttach.ContentMediaType = sContentType & "; name=""" & sFile & """"
iPartAttach.ContentTransferEncoding = "base64"
iPartAttach.Fields("urn:schemas:mailheader:priority") = ""
iPartAttach.Fields("urn:schemas:mailheader:importance") = ""
iPartAttach.Fields("urn:schemas:mailheader:content-transfer-encoding") = "base64"
iPartAttach.Fields("urn:schemas:mailheader:content-disposition") = "attachment; filename=""" & sFile & """"
iPartAttach.Fields.Update

Set stmWrite = iPartAttach.GetEncodedContentStream
stmWrite.WriteText c_Base64Sample
stmWrite.Flush
stmWrite.Close

 getting inserted before the base64 encoded representation of the binary data of GIF image, and displayed when read back as below:

Dim stm As ADODB.Stream
Set stm = i_iMsg.GetStream()
Text1.Text = stm.ReadText
stm.Close

R0lGODlhEAAOAPcAAAAAAIAAAACAAICAAAAAgIAAgACAgICAgMDAwP8AAAD/AP//AAAA//8A/wD

This could be corrected by setting the charset of the stream to "us-ascii"
stmWrite.Charset = "us-ascii"