int c = peekChar(); if (c == 'c' || c == 'C') { int offset = mOffset, index = mIndex; String first = readAtom(); if (first.equals("CHARSET")) { skipSpace();  charset = readAstring();  skipSpace(); boolean charsetOK = false; try { charsetOK = Charset.isSupported(charset); } catch (IllegalCharsetNameException icne) { } if (!charsetOK) throw new ImapParseException(mTag, "BADCHARSET", "unknown charset: " + charset, true); } else { mOffset = offset;  mIndex = index; }
if ("CHARSET".equals(peekAtom())) { skipAtom("CHARSET");  skipSpace();  charset = readAstring();  skipSpace(); boolean charsetOK = false; try { charsetOK = Charset.isSupported(charset); } catch (IllegalCharsetNameException icne) { } if (!charsetOK) throw new ImapParseException(mTag, "BADCHARSET", "unknown charset: " + charset, true);
    String readSearch(TreeMap<Integer, Object> insertions) throws ImapParseException {        String charset = null;        StringBuffer search = new StringBuffer();        int c = peekChar();        if (c == 'c' || c == 'C') {            int offset = mOffset, index = mIndex;            String first = readAtom();            if (first.equals("CHARSET")) {                skipSpace();  charset = readAstring();  skipSpace();                boolean charsetOK = false;                try {                    charsetOK = Charset.isSupported(charset);                } catch (IllegalCharsetNameException icne) { }                if (!charsetOK)                    throw new ImapParseException(mTag, "BADCHARSET", "unknown charset: " + charset, true);            } else {                mOffset = offset;  mIndex = index;            }        }        return readSearchClause(search, insertions, charset, MULTIPLE_CLAUSES).toString();    }