diff --git a/expat/xmlparse/xmlparse.c b/expat/xmlparse/xmlparse.c index c62dbd8b..e7391e4e 100755 --- a/expat/xmlparse/xmlparse.c +++ b/expat/xmlparse/xmlparse.c @@ -468,6 +468,18 @@ XML_Parser XML_ParserCreateNS(const XML_Char *encodingName, XML_Char nsSep) return parser; } +int XML_SetEncoding(XML_Parser parser, const XML_Char *encodingName) +{ + if (encodingName) + protocolEncodingName = 0; + else { + protocolEncodingName = poolCopyString(&tempPool, encodingName); + if (!protocolEncodingName) + return 0; + } + return 1; +} + XML_Parser XML_ExternalEntityParserCreate(XML_Parser oldParser, const XML_Char *context, const XML_Char *encodingName) diff --git a/expat/xmlparse/xmlparse.h b/expat/xmlparse/xmlparse.h index 473f2afe..0c0453af 100755 --- a/expat/xmlparse/xmlparse.h +++ b/expat/xmlparse/xmlparse.h @@ -306,6 +306,13 @@ XML_SetUserData(XML_Parser parser, void *userData); /* Returns the last value set by XML_SetUserData or null. */ #define XML_GetUserData(parser) (*(void **)(parser)) +/* This is equivalent to supplying an encoding argument +to XML_CreateParser. It must not be called before XML_Parse +or XML_ParseBuffer. */ + +int XMLPARSEAPI +XML_SetEncoding(XML_Parser parser, const XML_Char *encoding); + /* If this function is called, then the parser will be passed as the first argument to callbacks instead of userData. The userData will still be accessible using XML_GetUserData. */