diff options
author | Samuel Tardieu <sam@rfc1149.net> | 2014-04-10 14:07:12 +0200 |
---|---|---|
committer | Samuel Tardieu <sam@rfc1149.net> | 2014-04-10 14:07:12 +0200 |
commit | d01d25ef9ee90314429c7e5ea152e519e3bace41 (patch) | |
tree | 15d4906bf9960b21db47e9d9728380d0b89286df | |
parent | 8e765eb62fae1f99cb8bcf7853a2b34df21bc100 (diff) | |
download | cgeo-d01d25ef9ee90314429c7e5ea152e519e3bace41.zip cgeo-d01d25ef9ee90314429c7e5ea152e519e3bace41.tar.gz cgeo-d01d25ef9ee90314429c7e5ea152e519e3bace41.tar.bz2 |
Explicitely use ASCII when decoding a base64 binary
-rw-r--r-- | main/src/cgeo/geocaching/utils/ImageUtils.java | 2 | ||||
-rw-r--r-- | main/src/cgeo/geocaching/utils/TextUtils.java | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/main/src/cgeo/geocaching/utils/ImageUtils.java b/main/src/cgeo/geocaching/utils/ImageUtils.java index 6d7a437..68ea7bb 100644 --- a/main/src/cgeo/geocaching/utils/ImageUtils.java +++ b/main/src/cgeo/geocaching/utils/ImageUtils.java @@ -278,7 +278,7 @@ public final class ImageUtils { public static void decodeBase64ToStream(final String inString, final OutputStream out) throws IOException { Base64InputStream in = null; try { - in = new Base64InputStream(new ByteArrayInputStream(inString.getBytes()), Base64.DEFAULT); + in = new Base64InputStream(new ByteArrayInputStream(inString.getBytes(TextUtils.CHARSET_ASCII)), Base64.DEFAULT); IOUtils.copy(in, out); } finally { IOUtils.closeQuietly(in); diff --git a/main/src/cgeo/geocaching/utils/TextUtils.java b/main/src/cgeo/geocaching/utils/TextUtils.java index 5acb3a0..ef09f32 100644 --- a/main/src/cgeo/geocaching/utils/TextUtils.java +++ b/main/src/cgeo/geocaching/utils/TextUtils.java @@ -16,6 +16,7 @@ import java.util.regex.Pattern; public final class TextUtils { public static final Charset CHARSET_UTF8 = Charset.forName("UTF-8"); + public static final Charset CHARSET_ASCII = Charset.forName("US-ASCII"); private static final Pattern PATTERN_REMOVE_NONPRINTABLE = Pattern.compile("\\p{Cntrl}"); |