fix Base64 but breaks compat
[nikiroo-utils.git] / src / be / nikiroo / utils / streams / Base64.java
index 9ccd02ce3e39e7da4a0b02e98a75ff2bebd5b219..a4f1240aa6603109cf6fb14f17862dafaed59678 100644 (file)
  * limitations under the License.
  */
 
+/*
+ * Changes (@author niki):
+ * - default charset -> UTF-8
+ */
+
 package be.nikiroo.utils.streams;
 
 import java.io.UnsupportedEncodingException;
@@ -115,7 +120,12 @@ class Base64 {
      * incorrect padding
      */
     public static byte[] decode(String str, int flags) {
-        return decode(str.getBytes(), flags);
+       try{
+               return decode(str.getBytes("UTF-8"), flags);
+       } catch (UnsupportedEncodingException e) {
+               // All conforming JVM are expected to support UTF-8
+               return null;
+       }
     }
 
     /**