I'm using org.apache.commons.codec.binary for base64 encoding. For at least short text files it works, but when I try to encode eg. a JPEG image, there is a problem. After decoding the pixel amount is correct and it shows it as an image, but the image is somehow scrambled. For these JPEG files, about two thirds of the image blocks are messed up, and the last third of the blocks are shown as mere gray.
Any ideas what could cause this?