Page 1 of 1

Base64 Question

Posted: Tue Nov 18, 2008 10:22 pm
by Straker
Here's my issue. I have been trying to decode from Base64 several different MIME Email attachments. I use Base64Decoder mostly without problems, but on some encoded strings (large ones - like pictures), it fails because of the trailing "=", which once removed, will work.

So my question is: Why is it that some Base64 encoded strings can only be decoded if they have the trailing "=", and some can only be decoded if the trailing "=" is removed? Is it a string length issue?

Just trying to get a better understanding...

Posted: Thu Nov 20, 2008 6:22 pm
by Sparkie
Test for proper string length with this. You should get a 0 every time.

Code: Select all

Debug (Len(YourBase64EncodedString)*8) % 32

Posted: Tue Dec 16, 2008 7:28 pm
by Straker
Once again, thanks Sparkie!

Posted: Wed Dec 17, 2008 6:44 pm
by Sparkie
You're welcome Straker :)