getBase64FromImage returning blank spaces


after having some issues with getBase64FromImage i decided to send to my mail the result and i got an string with some blank spaces on it (if i’m not wrong that should not be allowed in a base64 string). I guess that’s a bug.

testing on a Nexus 7. Fuse 0.26

        .then(function(image) {                
                email.compose("myEmail", "", "", "subject", ImageBase);
        }, function(error) {
            // Will be called if the user aborted the selection or if an error occurred.

Hey! For fun, if you still have that email, did it actually look like a base64 string with some erroneous spaces in it or did it just look like some garbage? The B64 encoding on Android is handled through the android.util.Base64 class so this is likely me having configured it wrong somehow. Curious to see the string you got though.

It looks as a base64 string with spaces in it. How do u want me to share it with u? :slight_smile:

here u have it:

E-mail messages doesn’t support very long lines without additional encoding, so it’s likely that the spaces are required to avoid breaking the email-transport.

if i show something like: imgStr.substring(0,50) i see the blank spaces if i URIEncode the result and send it to the email there are blank spaces encoded

btw: in the email i get carriage returns but those are not in the original base64 string


after updating to 0.27 it’s working on Android (great!!) but NOT on iOS :slight_smile:

I tried an example with a very small image (to avoid having problems with text formating)

what i got was:

Android (correct base64 image):


iPhone (non valid base64 image):


i tried both with this online converter:

Hmmm thanks for that extra info. So looking at our code now what seems to be going wrong is that the image representation returned on iOS is actually a jpg and on android it’s a png. This is clearly wrong, as it should be either the same on both or allow you to choose, so that’s going into an issue.

This would explain why the Base64 comes out different. I’ll write up some tests so the returned data is identical.

Thanks for reporting in detail