From bf193b3218a95b86bf1c31937483f5845585bcd5 Mon Sep 17 00:00:00 2001 From: zzz <zzz@mail.i2p> Date: Sat, 23 Dec 2017 18:36:13 +0000 Subject: [PATCH] SusiMail: Don't convert underscore to space after base64 decoding --- .../i2p/susi/webmail/encoding/HeaderLine.java | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/apps/susimail/src/src/i2p/susi/webmail/encoding/HeaderLine.java b/apps/susimail/src/src/i2p/susi/webmail/encoding/HeaderLine.java index 560eaa330e..2da2dbd3af 100644 --- a/apps/susimail/src/src/i2p/susi/webmail/encoding/HeaderLine.java +++ b/apps/susimail/src/src/i2p/susi/webmail/encoding/HeaderLine.java @@ -195,18 +195,26 @@ public class HeaderLine extends Encoding { String charset = new String(in, f1 + 1, f2 - f1 - 1, "ISO-8859-1"); String clc = charset.toLowerCase(Locale.US); if (clc.equals("utf-8") || clc.equals("utf8")) { - for( int j = 0; j < tmp.length; j++ ) { - byte d = tmp.content[ tmp.offset + j ]; - out.write( d == '_' ? 32 : d ); + if (enc.equals("quoted-printable")) { + for( int j = 0; j < tmp.length; j++ ) { + byte d = tmp.content[ tmp.offset + j ]; + out.write( d == '_' ? 32 : d ); + } + } else { + out.write(tmp.content, tmp.offset, tmp.length); } } else { // decode string String decoded = new String(tmp.content, tmp.offset, tmp.length, charset); // encode string byte[] utf8 = DataHelper.getUTF8(decoded); - for( int j = 0; j < utf8.length; j++ ) { - byte d = utf8[j]; - out.write( d == '_' ? 32 : d ); + if (enc.equals("quoted-printable")) { + for( int j = 0; j < utf8.length; j++ ) { + byte d = utf8[j]; + out.write( d == '_' ? 32 : d ); + } + } else { + out.write(utf8); } } int distance = f4 + 2 - offset; -- GitLab