Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions sope-xml/libxmlSAXDriver/libxmlHTMLSAXDriver.m
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

#include <libxml/HTMLparser.h>
#include <libxml/HTMLtree.h>
#include <libxml/parserInternals.h>

@interface NSObject(contentHandlerExtensions)

Expand Down Expand Up @@ -248,6 +249,15 @@ - (void)setupParserWithDocumentPath:(NSString *)_path {
0 /* chunklen */,
[_path cString] /* filename */,
charEncoding /* encoding */);

// The enc parameter of htmlCreatePushParserCtxt is deprecated and ignored
// in libxml2 >= 2.12. Use xmlSwitchEncoding() to explicitly set the
// encoding on the parser context. This is backward-compatible with older
// libxml2 versions where it is a harmless no-op.
if (self->ctxt && charEncoding != XML_CHAR_ENCODING_NONE) {
xmlSwitchEncoding((xmlParserCtxtPtr)self->ctxt, charEncoding);
}

self->doc = NULL;
}
- (void)tearDownParser {
Expand Down