KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm using org.apache.commons.codec.binary.Base64 do decode string which is utf8. Sometimes I get base64 encoded string which after decode looks like for example ^@k��@@ . How can I check if base64 is correct or if decoded utf8 string is valid utf8 string? To clarify. I'm using public static String base64Decode(String str) { try { return new String(base64Decode(str.getBytes(Constants.UTF_8)), Constants.UTF_8); } catch (UnsupportedEncodingException e) { ... } } public static byte[] base64Decode(byte[] byteArray) { return Base64.decodeBase64(byteArray); }
Tags (comma-separated)
Save Edits
Cancel