473,503 Members | 1,748 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Convertion to base64 results in malformed data.

Rvo
I tried to write a little commandline tool that converts a file to a base64
datastream.
The application that needs to work with these base64 files (MS Word 2003 in
XML) doesn't accept the resultfiles of my tool though.
When I compare my resultfile with a file that has been generated by Word I
can see that only the first 3 characters of the stream are different.
No matter what file I convert, my first 3 chars are always " 9/" while Word
always writes "/9j". All other chars are identical.
Is this somekind of header? Do I use an incorrect datatype?

Below is a code snippet which I use to convert the data. (I added the '
before each line to work around a paranoid virusscanner)

'Dim fsi As New System.IO.FileStream(file, IO.FileMode.Open)
'Dim fso As System.IO.FileStream
'Try
' fso = New System.IO.FileStream(fileNameOut, IO.FileMode.CreateNew)
'Catch e As Exception
' fso = New System.IO.FileStream(fileNameOut, IO.FileMode.Truncate)
'End Try
'Dim br As New System.IO.BinaryReader(fsi)
'Dim bw As New System.IO.BinaryWriter(fso)
'Dim targetString As String

'targetString = Convert.ToBase64String(br.ReadBytes(CInt(fi.Length ())))

'bw.Write(targetString)
'bw.Close()
'br.Close()
'fso.Close()
'fsi.Close()
Thanks in advance,

Romain
Nov 20 '05 #1
0 765

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
4201
by: Ramy076 | last post by:
I have a C App which uses openssl for Encoding and decoding which needs to be ported to java. The decoded text does not match between the C App and the java App. The size of the output itself is...
2
2551
by: Karl Pech | last post by:
Hi all, I'm trying to write a program which can read in files in the following format: sos_encoded.txt: --- begin-base64 644 sos.txt UGxlYXNlLCBoZWxwIG1lIQ== ---
1
2161
by: Petr Studenovsky | last post by:
Hello I made small GUI test program in Visual Basic NET for SQL communication. I need some help with these problems. problem 1) If I change some settings in datagrid from properties window...
0
448
by: BW | last post by:
Sorted my problem. Issue - retrieve Base64 encoded Zlib compressed XML stream. The compressed XML stream was compressed using Zlib on a Java platform. Resolution. (VB.NET) 1) Retrieve...
27
14986
by: gRizwan | last post by:
Hello all, We have a problem on a webpage. That page is sent some email data in base64 format. what we need to do is, decode the base64 data back to original shape and extract attached image...
4
5341
by: John | last post by:
Hi all, I've been going through google and yahoo looking for a certain base64 decoder in C without success. What I'm after is something that you can pass a base64 encoded string into and get back...
13
14714
by: aruna.eies.eng | last post by:
i am currently trying to convert data into binary data.for that i need to know how to achieve it in c language and what are the libraries that we can use. so if any one can send me a sample code or...
1
24106
by: Shalako | last post by:
I check my error log and see these entries: malformed header from script. Bad header= Missing gauge reports are ind: padata.pl /perl/pema/padata.pl did not send an HTTP header malformed...
5
6848
by: wbsurfver | last post by:
I am using the two functions below to encode part of a url. I had seen that someone said base64 can sometimes add newlines in the encoding, but had little luck finding reference to that using...
0
7188
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7258
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7313
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7441
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4987
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3156
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3146
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1489
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
366
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.