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,18 +195,26 @@ public class HeaderLine extends Encoding {
String charset = new String(in, f1 + 1, f2 - f1 - 1, "ISO-8859-1"); String charset = new String(in, f1 + 1, f2 - f1 - 1, "ISO-8859-1");
String clc = charset.toLowerCase(Locale.US); String clc = charset.toLowerCase(Locale.US);
if (clc.equals("utf-8") || clc.equals("utf8")) { if (clc.equals("utf-8") || clc.equals("utf8")) {
for( int j = 0; j < tmp.length; j++ ) { if (enc.equals("quoted-printable")) {
byte d = tmp.content[ tmp.offset + j ]; for( int j = 0; j < tmp.length; j++ ) {
out.write( d == '_' ? 32 : d ); byte d = tmp.content[ tmp.offset + j ];
out.write( d == '_' ? 32 : d );
}
} else {
out.write(tmp.content, tmp.offset, tmp.length);
} }
} else { } else {
// decode string // decode string
String decoded = new String(tmp.content, tmp.offset, tmp.length, charset); String decoded = new String(tmp.content, tmp.offset, tmp.length, charset);
// encode string // encode string
byte[] utf8 = DataHelper.getUTF8(decoded); byte[] utf8 = DataHelper.getUTF8(decoded);
for( int j = 0; j < utf8.length; j++ ) { if (enc.equals("quoted-printable")) {
byte d = utf8[j]; for( int j = 0; j < utf8.length; j++ ) {
out.write( d == '_' ? 32 : d ); byte d = utf8[j];
out.write( d == '_' ? 32 : d );
}
} else {
out.write(utf8);
} }
} }
int distance = f4 + 2 - offset; int distance = f4 + 2 - offset;