mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2024-10-26 03:55:04 +03:00
parser: Downgrade XML_ERR_UNSUPPORTED_ENCODING to warning
If the actual encoding is UTF-8 or ASCII, we don't want to fail.
This commit is contained in:
parent
24b7144f2c
commit
451572615c
39
parser.c
39
parser.c
@ -6864,12 +6864,6 @@ xmlParseTextDecl(xmlParserCtxtPtr ctxt) {
|
||||
* We must have the encoding declaration
|
||||
*/
|
||||
xmlParseEncodingDecl(ctxt);
|
||||
if (ctxt->errNo == XML_ERR_UNSUPPORTED_ENCODING) {
|
||||
/*
|
||||
* The XML REC instructs us to stop parsing right here
|
||||
*/
|
||||
return;
|
||||
}
|
||||
|
||||
SKIP_BLANKS;
|
||||
if ((RAW == '?') && (NXT(1) == '>')) {
|
||||
@ -6916,13 +6910,6 @@ xmlParseExternalSubset(xmlParserCtxtPtr ctxt, const xmlChar *ExternalID,
|
||||
|
||||
if (CMP5(CUR_PTR, '<', '?', 'x', 'm', 'l')) {
|
||||
xmlParseTextDecl(ctxt);
|
||||
if (ctxt->errNo == XML_ERR_UNSUPPORTED_ENCODING) {
|
||||
/*
|
||||
* The XML REC instructs us to stop parsing right here
|
||||
*/
|
||||
xmlHaltParser(ctxt);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (ctxt->myDoc == NULL) {
|
||||
ctxt->myDoc = xmlNewDoc(BAD_CAST "1.0");
|
||||
@ -10371,12 +10358,6 @@ xmlParseXMLDecl(xmlParserCtxtPtr ctxt) {
|
||||
xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED, "Blank needed here\n");
|
||||
}
|
||||
xmlParseEncodingDecl(ctxt);
|
||||
if (ctxt->errNo == XML_ERR_UNSUPPORTED_ENCODING) {
|
||||
/*
|
||||
* The XML REC instructs us to stop parsing right here
|
||||
*/
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* We may have the standalone status.
|
||||
@ -10527,12 +10508,6 @@ xmlParseDocument(xmlParserCtxtPtr ctxt) {
|
||||
* Note that we will switch encoding on the fly.
|
||||
*/
|
||||
xmlParseXMLDecl(ctxt);
|
||||
if (ctxt->errNo == XML_ERR_UNSUPPORTED_ENCODING) {
|
||||
/*
|
||||
* The XML REC instructs us to stop parsing right here
|
||||
*/
|
||||
return(-1);
|
||||
}
|
||||
SKIP_BLANKS;
|
||||
} else {
|
||||
ctxt->version = xmlCharStrdup(XML_DEFAULT_VERSION);
|
||||
@ -10663,12 +10638,6 @@ xmlParseExtParsedEnt(xmlParserCtxtPtr ctxt) {
|
||||
* Note that we will switch encoding on the fly.
|
||||
*/
|
||||
xmlParseXMLDecl(ctxt);
|
||||
if (ctxt->errNo == XML_ERR_UNSUPPORTED_ENCODING) {
|
||||
/*
|
||||
* The XML REC instructs us to stop parsing right here
|
||||
*/
|
||||
return(-1);
|
||||
}
|
||||
SKIP_BLANKS;
|
||||
} else {
|
||||
ctxt->version = xmlCharStrdup(XML_DEFAULT_VERSION);
|
||||
@ -11102,14 +11071,6 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
|
||||
(IS_BLANK_CH(ctxt->input->cur[5]))) {
|
||||
ret += 5;
|
||||
xmlParseXMLDecl(ctxt);
|
||||
if (ctxt->errNo == XML_ERR_UNSUPPORTED_ENCODING) {
|
||||
/*
|
||||
* The XML REC instructs us to stop parsing right
|
||||
* here
|
||||
*/
|
||||
xmlHaltParser(ctxt);
|
||||
return(0);
|
||||
}
|
||||
} else {
|
||||
ctxt->version = xmlCharStrdup(XML_DEFAULT_VERSION);
|
||||
if (ctxt->version == NULL) {
|
||||
|
@ -175,9 +175,11 @@ xmlCtxtErrIO(xmlParserCtxtPtr ctxt, int code, const char *uri)
|
||||
if (ctxt == NULL)
|
||||
return;
|
||||
|
||||
if ((code == XML_IO_ENOENT) ||
|
||||
(code == XML_IO_NETWORK_ATTEMPT) ||
|
||||
(code == XML_IO_UNKNOWN)) {
|
||||
if (code == XML_ERR_UNSUPPORTED_ENCODING) {
|
||||
level = XML_ERR_WARNING;
|
||||
} else if ((code == XML_IO_ENOENT) ||
|
||||
(code == XML_IO_NETWORK_ATTEMPT) ||
|
||||
(code == XML_IO_UNKNOWN)) {
|
||||
if (ctxt->validate == 0)
|
||||
level = XML_ERR_WARNING;
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user