html: handle the html5 charset meta tag

This commit is contained in:
Jean-Francois Dockes 2012-01-26 19:27:58 +01:00
parent 0d8a61ced9
commit ec87379015

View File

@ -391,7 +391,7 @@ MyHtmlParser::opening_tag(const string &tag)
p.params.end()) {
charset = k->second;
if (!samecharset(charset, fromcharset)) {
LOGDEB1(("Doc specified charset '%s' "
LOGDEB1(("Doc http-equiv charset '%s' "
"differs from dir deflt '%s'\n",
charset.c_str(),
fromcharset.c_str()));
@ -401,6 +401,19 @@ MyHtmlParser::opening_tag(const string &tag)
}
}
}
string newcharset;
if (get_parameter(cstr_charset, newcharset)) {
// HTML5 added: <meta charset="...">
lowercase_term(newcharset);
charset = newcharset;
if (!samecharset(charset, fromcharset)) {
LOGDEB1(("Doc html5 charset '%s' "
"differs from dir deflt '%s'\n",
charset.c_str(),
fromcharset.c_str()));
throw false;
}
}
break;
}
if (tag == "marquee" || tag == "menu" || tag == "multicol")