Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Encoding to and from Base64
Message
From
24/06/2006 23:21:28
 
 
To
All
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Title:
Encoding to and from Base64
Environment versions
Environment:
VB 8.0
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01131466
Message ID:
01131466
Views:
79
I must be missing something here. I encode the content of a JPG file into Base64 and doing the reverse process. Here is the code:
        Dim lcEncoded As String = ""
        lcEncoded = Convert.ToBase64String(System.Text.Encoding.Default.GetBytes(oApp.FileToStr("d:\Logo.jpg")))
        oApp.CreateFile(System.Text.Encoding.Default.GetString(Convert.FromBase64String(lcEncoded)), "d:\Logo2.jpg")
So, the source file is Logo.jpg. That is a 35kb file. If I take the encoded Base64 version of it and do the reverse process to obtain the original content that was used for the encoding, it gives 18kb. This is what is saved in Logo2.jpg. I would have assumed if would be the same as Logo.jpg, the original file, but it is not.

Is there someone who can explain me why I do not obtain the same file in Logo2.jpg?
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Next
Reply
Map
View

Click here to load this message in the networking platform