replace "ISO-8859-1" with StandardCharsets

This commit is contained in:
Unpublished 2019-02-22 16:57:52 +01:00
parent 3285867499
commit 72dcc50ea1
1 changed files with 5 additions and 7 deletions

View File

@ -34,6 +34,7 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Date;
import java.util.Enumeration;
@ -624,13 +625,10 @@ public class MessageHelper {
if (TextUtils.isEmpty(charset)) {
if (BuildConfig.DEBUG)
warnings.add(context.getString(R.string.title_no_charset, ct.toString()));
if (part.isMimeType("text/plain"))
try {
// The first 127 characters are the same as in US-ASCII
result = new String(result.getBytes("ISO-8859-1"));
} catch (UnsupportedEncodingException ex) {
warnings.add(Helper.formatThrowable(ex));
}
if (part.isMimeType("text/plain")) {
// The first 127 characters are the same as in US-ASCII
result = new String(result.getBytes(StandardCharsets.ISO_8859_1));
}
} else {
if ("US-ASCII".equals(Charset.forName(charset).name()) &&
!"US-ASCII".equals(charset.toUpperCase()))