Android Utililty Methods Charset Convert

List of utility methods to do Charset Convert

Description

The list of methods to do Charset Convert are organized into topic(s).

Method

booleanisCharset(final String str, final String charset, int judgeCharsetLength)
is Charset
try {
    String temp = str.length() > judgeCharsetLength ? str
            .substring(0, judgeCharsetLength) : str;
    return temp.equals(new String(temp.getBytes(charset), charset));
} catch (Throwable e) {
    return false;
StringtoCharset(final String str, final String charset, int judgeCharsetLength)
to Charset
try {
    String oldCharset = getEncoding(str, judgeCharsetLength);
    return new String(str.getBytes(oldCharset), charset);
} catch (Throwable ex) {
    LogUtils.w(ex);
    return str;
StringchangeCharset(String str, String from, String to)
change Charset
String newStr = null;
newStr = new String(str.getBytes(from), to);
return newStr;