Fix error code in xmlTextWriterStartDocument
Return XML_ERR_UNSUPPORTED_ENCODING if no encoding handler could be
found.
Fixes bug #521808:
https://bugzilla.gnome.org/show_bug.cgi?id=521808
Resolves !53.
diff --git a/xmlwriter.c b/xmlwriter.c
index 58ffab6..58445c8 100644
--- a/xmlwriter.c
+++ b/xmlwriter.c
@@ -541,8 +541,8 @@
if (encoding != NULL) {
encoder = xmlFindCharEncodingHandler(encoding);
if (encoder == NULL) {
- xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY,
- "xmlTextWriterStartDocument : out of memory!\n");
+ xmlWriterErrMsg(writer, XML_ERR_UNSUPPORTED_ENCODING,
+ "xmlTextWriterStartDocument : unsupported encoding\n");
return -1;
}
}