473,651 Members | 2,566 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.FileS tream(file, IO.FileMode.Ope n)
'Dim fso As System.IO.FileS tream
'Try
' fso = New System.IO.FileS tream(fileNameO ut, IO.FileMode.Cre ateNew)
'Catch e As Exception
' fso = New System.IO.FileS tream(fileNameO ut, IO.FileMode.Tru ncate)
'End Try
'Dim br As New System.IO.Binar yReader(fsi)
'Dim bw As New System.IO.Binar yWriter(fso)
'Dim targetString As String

'targetString = Convert.ToBase6 4String(br.Read Bytes(CInt(fi.L ength())))

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

Romain
Nov 20 '05 #1
0 770

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

Similar topics

0
4215
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 wrong. I think i am doing something basically wrong. pls help. Output is not the same as seen here because of special characters Output from C: is only 12 bytes long
2
2561
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
2182
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 (e.g. background color). my datatest is removed. I compared it with diff program and it reorganized all source code.
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 XML stream using webresponse class
27
15030
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 from it. Any help will be highly appriciated. Thanks
4
5356
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 a decoded String. Any help is very much appreciated. Thanks Philip.
13
14766
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 send me the library file which helps that is really grateful. aruna.
1
24131
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 header from script. Bad header= : padata.pl /perl/pema/padata.pl did not send an HTTP header 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
6857
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 google, but I want to make sure I am safe. my url looks like this: http://my.local/index.php/widget/filterlist/js_addr_url/aHR0cDovL21lZGlhLmVuZy50ZWNodGFyZ2V0LmNvbS93aWRnZXRzL3N5bmRpY2F0ZWRfbmV3cy9 // functions to code url segments ...
0
8352
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8275
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8802
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8697
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8465
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6158
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5612
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
1909
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1587
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.