applied a couple of patches from Mark Itzcovitz to handle saving back
* tree.c: applied a couple of patches from Mark Itzcovitz
to handle saving back "UTF-16" documents.
Daniel
diff --git a/tree.c b/tree.c
index ff53a3e..826c37f 100644
--- a/tree.c
+++ b/tree.c
@@ -7865,7 +7865,9 @@
return;
} else if (doc_charset != XML_CHAR_ENCODING_UTF8) {
- conv_hdlr = xmlFindCharEncodingHandler(txt_encoding);
+ conv_hdlr = xmlGetCharEncodingHandler(doc_charset);
+ if (conv_hdlr == NULL)
+ conv_hdlr = xmlFindCharEncodingHandler(txt_encoding);
if ( conv_hdlr == NULL ) {
xmlGenericError(xmlGenericErrorContext,
"%s: %s %s '%s'\n",
@@ -8050,7 +8052,9 @@
return(-1);
}
if (enc != XML_CHAR_ENCODING_UTF8) {
- handler = xmlFindCharEncodingHandler(encoding);
+ handler = xmlGetCharEncodingHandler(enc);
+ if (handler == NULL)
+ handler = xmlFindCharEncodingHandler(encoding);
if (handler == NULL) {
xmlFree((char *) cur->encoding);
cur->encoding = NULL;