Workaround for HTML UTF-8 that is ISO8859-1

This commit is contained in:
M66B 2020-03-16 12:26:10 +01:00
parent 74f4ffa7de
commit 1499a1db80
1 changed files with 4 additions and 1 deletions

View File

@ -1471,9 +1471,12 @@ public class MessageHelper {
if (!TextUtils.isEmpty(charset)) if (!TextUtils.isEmpty(charset))
try { try {
Log.i("Charset=" + meta); Log.i("Charset=" + meta);
Charset c = Charset.forName(charset);
if (c.equals(StandardCharsets.UTF_8) && !Helper.isUTF8(result))
break;
result = new String(result.getBytes(StandardCharsets.ISO_8859_1), charset); result = new String(result.getBytes(StandardCharsets.ISO_8859_1), charset);
break; break;
} catch (UnsupportedEncodingException ex) { } catch (Throwable ex) {
Log.w(ex); Log.w(ex);
} }
} }