1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-03-28 22:50:07 +03:00

parser: Never use UTF-8 encoding handler

This commit is contained in:
Nick Wellnhofer 2023-08-16 19:20:47 +02:00
parent 507f11edf0
commit 61b8e097b9

View File

@ -1386,6 +1386,15 @@ xmlSwitchInputEncoding(xmlParserCtxtPtr ctxt, xmlParserInputPtr input,
input->flags |= XML_INPUT_HAS_ENCODING;
input->flags &= ~XML_INPUT_8_BIT;
/*
* UTF-8 requires no encoding handler.
*/
if ((handler != NULL) &&
(xmlStrcasecmp(BAD_CAST handler->name, BAD_CAST "UTF-8") == 0)) {
xmlCharEncCloseFunc(handler);
handler = NULL;
}
if (in->encoder == handler)
return (0);