mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-28 00:21:53 +03:00
fix #348252 if the document clains to be in a different encoding in the
* HTMLparser.c: fix #348252 if the document clains to be in a different encoding in the meta tag and it's obviously wrong, don't screw up the end of the content. Daniel
This commit is contained in:
13
HTMLparser.c
13
HTMLparser.c
@ -3291,7 +3291,18 @@ htmlCheckEncoding(htmlParserCtxtPtr ctxt, const xmlChar *attvalue) {
|
||||
* registered set of known encodings
|
||||
*/
|
||||
if (enc != XML_CHAR_ENCODING_ERROR) {
|
||||
xmlSwitchEncoding(ctxt, enc);
|
||||
if (((enc == XML_CHAR_ENCODING_UTF16LE) ||
|
||||
(enc == XML_CHAR_ENCODING_UTF16BE) ||
|
||||
(enc == XML_CHAR_ENCODING_UCS4LE) ||
|
||||
(enc == XML_CHAR_ENCODING_UCS4BE)) &&
|
||||
(ctxt->input->buf != NULL) &&
|
||||
(ctxt->input->buf->encoder == NULL)) {
|
||||
htmlParseErr(ctxt, XML_ERR_INVALID_ENCODING,
|
||||
"htmlCheckEncoding: wrong encoding meta\n",
|
||||
NULL, NULL);
|
||||
} else {
|
||||
xmlSwitchEncoding(ctxt, enc);
|
||||
}
|
||||
ctxt->charset = XML_CHAR_ENCODING_UTF8;
|
||||
} else {
|
||||
/*
|
||||
|
Reference in New Issue
Block a user