title: Java BASE64 utf8 string decoding
body: <p>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 <code>^@kďż˝ďż˝@@</code>. How can I check if base64 is correct or if decoded utf8 string is valid utf8 string?</p>
  
  <p>To clarify. I'm using  </p>
  
  <pre><code>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);
  }
  </code></pre>