Q:

Why does android.util.Base64 return a different string?

I'm using android.util.Base64 to encode a username + password for HTTP Basic Authentication like so:
String encoded = Base64.encodeToString((username+":"+password).getBytes(), Base64.NO_WRAP);

If I used "user" & "pass" for the username and password I would expect to get dXNlcjpwYXNzCg== (from openssl)
echo 'user:pass' | openssl base64

but instead I get this:

Any ideas why this is?
Thanks,
Jake
Note: Simply passing the resulting string to a show progress dialog:
Tools.ShowProgress(encoded, Login.this);

A:

(username+":"+password).getBytes()

String.getBytes() returns the bytes of the string in the current platform encoding. To ensure you match other platforms, you probably want to use String.getBytes(Charset) with UTF-8:
(username+":"+password).getBytes("UTF-8")

If that's not the issue, another thing to check is if your input is what you think it is:
String input = username+":"+password;
log.warn("Input was: " + input);
// calculate base64

