Commits

ph...@9ae0c189-cd1f-4510-a509-f4891f5cf20d  committed d51ef15

Modified Files:
dom.c
+ domCreateDocument uses UTF8 if the NULL encoding is passed

  • Participants
  • Parent commits 874ed1a

Comments (0)

Files changed (1)

 
 xmlDocPtr
 domCreateDocument( xmlChar *version, xmlChar *enc ){
-  xmlDocPtr doc = 0;
+    xmlDocPtr doc = 0;
     doc = xmlNewDoc( version );  
     doc->charset  = XML_CHAR_ENCODING_UTF8;
-    doc->encoding = xmlStrdup(enc);
+    if ( enc != NULL && *enc!= 0 ) {
+      /* if an encoding is passed, we will assume UTF8, otherwise we set 
+       * the passed encoding 
+       */
+        doc->encoding = xmlStrdup(enc);
+    }
+
     return doc;
 }