SusiMail: Don't convert underscore to space after base64 decoding

This commit is contained in:
zzz
2017-12-23 18:36:13 +00:00
parent 003d865cc3
commit bf193b3218

View File

@@ -195,19 +195,27 @@ 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")) {
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);
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;
offset += distance;