Is Base64 standardized?

At the company I work for, we have a class to convert to and from a Base64 string. When I first saw the code, I asked why you are not using the Convert.ToBase64String that comes with .NET?

Then I modified the body of the method to just call Convert.ToBase64String, but it does not generate the same string.

I tried using ASCII, UTF8, Unicode and UTF32.

I don’t remember exactly, but I think that ASCII generates a string with the same length, but some characters are different and others Enconding generate large strings.

Maybe our implementation was wrong, but I found a JavaScript implementation that matches ours.

Isn't Base64 Portable?

Edit: I found this on Wikipedia, but I don't know if that was the reason http://en.wikipedia.org/wiki/Base64#Implementations_and_history

Edit2 . I mentioned encodings because we convert the string to another. Then I need to first convert the original string to an array of bytes using some encoding

+8
javascript c # base64
source share
2 answers

There are at least 10 different implementations. Basically they differ char for indices 62 and 63.

http://en.wikipedia.org/wiki/Base64#Implementations_and_history

+3
source share

RFC 3548. No, wait! There is newer: RFC 4648 . (Thanks dtb!)

By the way, you seem to be mixing base64, which turns any binary stream into an ASCII stream and character encodings, which are completely different concepts. You can read this article about encodings.

+10
source share

All Articles