Decode US-ASCII as ISO_8859_1

pull/156/head
M66B 6 years ago
parent ba9340ab8e
commit 618a0cbfef

@ -847,9 +847,12 @@ public class MessageHelper {
// The first 127 characters are the same as in US-ASCII // The first 127 characters are the same as in US-ASCII
result = new String(result.getBytes(StandardCharsets.ISO_8859_1)); result = new String(result.getBytes(StandardCharsets.ISO_8859_1));
} else { } else {
if ("US-ASCII".equals(Charset.forName(charset).name()) && if ("US-ASCII".equals(charset.toUpperCase()))
!"US-ASCII".equals(charset.toUpperCase())) result = new String(result.getBytes(StandardCharsets.ISO_8859_1));
warnings.add(context.getString(R.string.title_no_charset, charset)); else {
if ("US-ASCII".equals(Charset.forName(charset).name()))
warnings.add(context.getString(R.string.title_no_charset, charset));
}
} }
} catch (ParseException ex) { } catch (ParseException ex) {
Log.w(ex); Log.w(ex);

Loading…
Cancel
Save