Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: srcs/parserInternals.c
- ===================================================================
- --- srcs/parserInternals.c (revision 1054838)
- +++ srcs/parserInternals.c (working copy)
- @@ -948,6 +948,8 @@
- {
- xmlCharEncodingHandlerPtr handler;
- + if (ctxt->forceUTF8 == 1) enc = XML_CHAR_ENCODING_UTF8;
- +
- if (ctxt == NULL) return(-1);
- switch (enc) {
- case XML_CHAR_ENCODING_ERROR:
- @@ -1668,6 +1670,7 @@
- ctxt->errNo = XML_ERR_OK;
- ctxt->depth = 0;
- ctxt->charset = XML_CHAR_ENCODING_UTF8;
- + ctxt->forceUTF8 = 0;
- ctxt->catalogs = NULL;
- xmlInitNodeInfoSeq(&ctxt->node_seq);
- return(0);
- Index: srcs/parser.c
- ===================================================================
- --- srcs/parser.c (revision 1054838)
- +++ srcs/parser.c (working copy)
- @@ -8929,6 +8929,15 @@
- } else {
- xmlFatalErr(ctxt, XML_ERR_STRING_NOT_STARTED, NULL);
- }
- +
- + if (ctxt->forceUTF8) {
- + if (encoding != NULL)
- + xmlFree((xmlChar *) encoding);
- + if (ctxt->encoding != NULL)
- + xmlFree((xmlChar *) ctxt->encoding);
- + ctxt->encoding = xmlCharStrdup("UTF-8");
- + return(ctxt->encoding);
- + }
- /*
- * UTF-16 encoding stwich has already taken place at this stage,
- * more over the little-endian/big-endian selection is already done
- @@ -13298,6 +13307,12 @@
- ctxt->options |= XML_PARSE_COMPACT;
- options -= XML_PARSE_COMPACT;
- }
- + if (options & XML_FORCE_UTF8) {
- + ctxt->forceUTF8 = 1;
- + options -= XML_FORCE_UTF8;
- + } else {
- + ctxt->forceUTF8 = 0;
- + }
- ctxt->linenumbers = 1;
- return (options);
- }
- Index: parser.h
- ===================================================================
- --- parser.h (revision 1054838)
- +++ parser.h (working copy)
- @@ -247,6 +247,7 @@
- xmlParserInputPtr entity; /* used to check entities boundaries */
- int charset; /* encoding of the in-memory content
- actually an xmlCharEncoding */
- + int forceUTF8; /* ignoring encodings, using UTF8 for everywhere */
- int nodelen; /* Those two fields are there to */
- int nodemem; /* Speed up large node parsing */
- int pedantic; /* signal pedantic warnings */
- @@ -1089,9 +1090,10 @@
- XML_PARSE_NSCLEAN = 1<<13,/* remove redundant namespaces declarations */
- XML_PARSE_NOCDATA = 1<<14,/* merge CDATA as text nodes */
- XML_PARSE_NOXINCNODE= 1<<15,/* do not generate XINCLUDE START/END nodes */
- - XML_PARSE_COMPACT = 1<<16 /* compact small text nodes; no modification of
- + XML_PARSE_COMPACT = 1<<16, /* compact small text nodes; no modification of
- the tree allowed afterwards (will possibly
- crash if you try to modify the tree) */
- + XML_FORCE_UTF8 = 1<<17 /* force ignoring any charsets and use utf8 for everything */
- } xmlParserOption;
- XMLPUBFUN void XMLCALL
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement