diff --git a/ChangeLog b/ChangeLog index 124d6623..2efe548f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sun Jul 29 07:18:53 EDT 2001 Daniel Veillard + + * parser.c: don't override existing encoding specified before + starting xmlParseDocument() + Sat Jul 28 13:33:10 EDT 2001 Daniel Veillard * include/libxml/xmlwin32version.h: reinserted, needed for diff --git a/parser.c b/parser.c index c14b8533..c49765f8 100644 --- a/parser.c +++ b/parser.c @@ -7297,18 +7297,20 @@ xmlParseDocument(xmlParserCtxtPtr ctxt) { if ((ctxt->sax) && (ctxt->sax->setDocumentLocator)) ctxt->sax->setDocumentLocator(ctxt->userData, &xmlDefaultSAXLocator); - /* - * Get the 4 first bytes and decode the charset - * if enc != XML_CHAR_ENCODING_NONE - * plug some encoding conversion routines. - */ - start[0] = RAW; - start[1] = NXT(1); - start[2] = NXT(2); - start[3] = NXT(3); - enc = xmlDetectCharEncoding(start, 4); - if (enc != XML_CHAR_ENCODING_NONE) { - xmlSwitchEncoding(ctxt, enc); + if (ctxt->encoding == XML_CHAR_ENCODING_NONE) { + /* + * Get the 4 first bytes and decode the charset + * if enc != XML_CHAR_ENCODING_NONE + * plug some encoding conversion routines. + */ + start[0] = RAW; + start[1] = NXT(1); + start[2] = NXT(2); + start[3] = NXT(3); + enc = xmlDetectCharEncoding(start, 4); + if (enc != XML_CHAR_ENCODING_NONE) { + xmlSwitchEncoding(ctxt, enc); + } }