Trim word encoding

This commit is contained in:
M66B 2021-08-24 17:44:15 +02:00
parent 1396b2799a
commit 9741825fd1
1 changed files with 3 additions and 2 deletions

View File

@ -1824,12 +1824,13 @@ public class MessageHelper {
} }
static byte[] decodeWord(String word, String encoding, String charset) throws IOException { static byte[] decodeWord(String word, String encoding, String charset) throws IOException {
String e = encoding.trim();
ByteArrayInputStream bis = new ByteArrayInputStream(ASCIIUtility.getBytes(word)); ByteArrayInputStream bis = new ByteArrayInputStream(ASCIIUtility.getBytes(word));
InputStream is; InputStream is;
if (encoding.equalsIgnoreCase("B")) if (e.equalsIgnoreCase("B"))
is = new BASE64DecoderStream(bis); is = new BASE64DecoderStream(bis);
else if (encoding.equalsIgnoreCase("Q")) else if (e.equalsIgnoreCase("Q"))
is = new QDecoderStreamEx(bis); is = new QDecoderStreamEx(bis);
else { else {
Log.e(new UnsupportedEncodingException("Encoding=" + encoding)); Log.e(new UnsupportedEncodingException("Encoding=" + encoding));