mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-10-26 00:37:43 +03:00
html: Don't stop on unsupported encoding
Continue to parse unlike in the XML case.
This commit is contained in:
@@ -3628,10 +3628,6 @@ htmlCharEncCheckAsciiCompatible(htmlParserCtxt *ctxt,
|
|||||||
XML_ENC_INPUT | XML_ENC_HTML,
|
XML_ENC_INPUT | XML_ENC_HTML,
|
||||||
ctxt->convImpl, ctxt->convCtxt,
|
ctxt->convImpl, ctxt->convCtxt,
|
||||||
&handler);
|
&handler);
|
||||||
/*
|
|
||||||
* TODO: Unlike the XML parser, we shouldn't raise a fatal
|
|
||||||
* if the encoding is unsupported.
|
|
||||||
*/
|
|
||||||
if (res != XML_ERR_OK) {
|
if (res != XML_ERR_OK) {
|
||||||
xmlFatalErr(ctxt, res, (const char *) encoding);
|
xmlFatalErr(ctxt, res, (const char *) encoding);
|
||||||
return(-1);
|
return(-1);
|
||||||
@@ -3711,10 +3707,6 @@ htmlCheckMeta(htmlParserCtxtPtr ctxt, const xmlChar **atts) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: Unlike the XML parser, we shouldn't raise a fatal
|
|
||||||
* if the encoding is unsupported.
|
|
||||||
*/
|
|
||||||
xmlSetDeclaredEncoding(ctxt, encoding);
|
xmlSetDeclaredEncoding(ctxt, encoding);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -468,14 +468,24 @@ void
|
|||||||
xmlFatalErr(xmlParserCtxt *ctxt, xmlParserErrors code, const char *info)
|
xmlFatalErr(xmlParserCtxt *ctxt, xmlParserErrors code, const char *info)
|
||||||
{
|
{
|
||||||
const char *errmsg;
|
const char *errmsg;
|
||||||
|
xmlErrorDomain domain = XML_FROM_PARSER;
|
||||||
|
xmlErrorLevel level = XML_ERR_FATAL;
|
||||||
|
|
||||||
errmsg = xmlErrString(code);
|
errmsg = xmlErrString(code);
|
||||||
|
|
||||||
|
if ((ctxt != NULL) && (ctxt->html)) {
|
||||||
|
domain = XML_FROM_HTML;
|
||||||
|
|
||||||
|
/* Continue if encoding is unsupported */
|
||||||
|
if (code == XML_ERR_UNSUPPORTED_ENCODING)
|
||||||
|
level = XML_ERR_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
if (info == NULL) {
|
if (info == NULL) {
|
||||||
xmlCtxtErr(ctxt, NULL, XML_FROM_PARSER, code, XML_ERR_FATAL,
|
xmlCtxtErr(ctxt, NULL, domain, code, level,
|
||||||
NULL, NULL, NULL, 0, "%s\n", errmsg);
|
NULL, NULL, NULL, 0, "%s\n", errmsg);
|
||||||
} else {
|
} else {
|
||||||
xmlCtxtErr(ctxt, NULL, XML_FROM_PARSER, code, XML_ERR_FATAL,
|
xmlCtxtErr(ctxt, NULL, domain, code, level,
|
||||||
(const xmlChar *) info, NULL, NULL, 0,
|
(const xmlChar *) info, NULL, NULL, 0,
|
||||||
"%s: %s\n", errmsg, info);
|
"%s: %s\n", errmsg, info);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user