Add a hook for hinting charset conversions to Java, since Android's java

doesn't know about all conversions.
This commit is contained in:
Jesse Vincent 2010-08-12 02:22:25 +00:00
parent 9871f1be53
commit d123aa2a39
1 changed files with 17 additions and 1 deletions

View File

@ -374,7 +374,8 @@ public class MimeUtility
/*
* See if there is conversion from the MIME charset to the Java one.
*/
charset = Charset.forName(originalCharset).name();
charset = Charset.forName(fixupCharset(originalCharset)).name();
if (charset == null)
{
@ -592,4 +593,19 @@ public class MimeUtility
}
return DEFAULT_ATTACHMENT_MIME_TYPE;
}
private static String fixupCharset(String charset)
{
charset = charset.toLowerCase();
if (charset.equals("cp932"))
return "shift-jis";
else if (charset.equals("koi8-u"))
return "koi8-r";
return charset;
}
}