Reputation: 11919
I have the following problem:
I sent this string over AWS SQS service (with no quotes) using python:
"Talhão"
When I looked at the web interface of SQS, I found the following string (also with no quotes):
"VGFsaMOjbw=="
Which also is the same string returned in the android java API of SQS. How do I convert "VGFsaMOjbw==" back to "Talhão"? Already tried this code, but didn't worked:
String debug = new String(m.getBody().getBytes(), "UTF-8");
Update: Found out how to do it using java. Must be converted to base64.
String debug = m.getBody();
Log.d("AWSQS", debug);
byte[] tmp2 = Base64.decode(debug, Base64.DEFAULT);
String val2 = new String(tmp2, "UTF-8");
Log.d("AWSQS", val2);
Upvotes: 0
Views: 143
Reputation: 12900
In Python, you would do:
binascii.a2b_base64(s).decode('utf-8')
If you're looking for the Java equivalent to that, then you need to put a "Java" tag instead of a "Python" tag in your question :-)
Upvotes: 1