// look for the comment page directive containing the charset
int s = snippet.getBuffer().indexOf(Parser.START_CHARSET_TOKEN);
if (s > -1) {
int e = snippet.getBuffer().indexOf(Parser.END_CHARSET_TOKEN, s);
AttributeTokenizer tokenizer = new AttributeTokenizer(snippet.getBuffer(), s, e, 1, 0);
Iterator ti = tokenizer.iterator();
while (ti.hasNext()) {
Map.Entry attribute = (Map.Entry) ti.next();
Token key = (Token) attribute.getKey();
//check the attribute name, we are only interested
//in "charset"