Created
December 30, 2009 21:40
-
-
Save libc/266416 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/ext/nokogiri/html_sax_parser_context.c b/ext/nokogiri/html_sax_parser_context.c | |
index be1ea23..f09b901 100644 | |
--- a/ext/nokogiri/html_sax_parser_context.c | |
+++ b/ext/nokogiri/html_sax_parser_context.c | |
@@ -25,9 +25,9 @@ static VALUE parse_memory(VALUE klass, VALUE data, VALUE encoding) | |
); | |
if(RTEST(encoding)) { | |
- xmlCharEncoding enc = xmlParseCharEncoding(StringValuePtr(encoding)); | |
- if(enc != XML_CHAR_ENCODING_ERROR) { | |
- xmlSwitchEncoding(ctxt, enc); | |
+ xmlCharEncodingHandlerPtr enc = xmlFindCharEncodingHandler(StringValuePtr(encoding)); | |
+ if(enc != NULL) { | |
+ xmlSwitchToEncoding(ctxt, enc); | |
if(ctxt->errNo == XML_ERR_UNSUPPORTED_ENCODING) { | |
rb_raise(rb_eRuntimeError, "Unsupported encoding %s", | |
StringValuePtr(encoding)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment