From e13261148beeb7b775ae71eb9be2ff5ec03da57f Mon Sep 17 00:00:00 2001 From: Daniel Veillard Date: Thu, 5 Jun 2003 09:32:20 +0000 Subject: [PATCH] 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 --- ChangeLog | 5 +++++ tree.c | 8 ++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index c9eea997..2b194a50 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Thu Jun 5 11:31:02 CEST 2003 Daniel Veillard + + * tree.c: applied a couple of patches from Mark Itzcovitz + to handle saving back "UTF-16" documents. + Mon Jun 2 21:56:15 MVT 2003 Daniel Veillard * relaxng.c xmlschemas.c include/libxml/schemasInternals.h: commiting diff --git a/tree.c b/tree.c index ff53a3ec..826c37f7 100644 --- a/tree.c +++ b/tree.c @@ -7865,7 +7865,9 @@ xmlDocDumpFormatMemoryEnc(xmlDocPtr out_doc, xmlChar **doc_txt_ptr, 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 @@ xmlDocFormatDump(FILE *f, xmlDocPtr cur, int format) { 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;