fixing bug #340398 xmlCharEncOutFunc writing to input buffer Daniel

* encoding.c: fixing bug #340398 xmlCharEncOutFunc writing to
  input buffer
Daniel
diff --git a/ChangeLog b/ChangeLog
index 7ef389d..ca1b793 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Tue May  2 14:24:40 CEST 2006 Daniel Veillard <daniel@veillard.com>
+
+	* encoding.c: fixing bug #340398 xmlCharEncOutFunc writing to
+	  input buffer
+
 Fri Apr 28 18:29:22 CEST 2006 Daniel Veillard <daniel@veillard.com>
 
 	* NEWS configure.in doc//*: preparing 2.6.24 release, fixed Python
diff --git a/encoding.c b/encoding.c
index dc1c205..6dee212 100644
--- a/encoding.c
+++ b/encoding.c
@@ -2083,7 +2083,8 @@
 		xmlEncodingErr(XML_I18N_CONV_FAILED,
 		    "output conversion failed due to conv error, bytes %s\n",
 			       buf);
-		in->content[0] = ' ';
+		if (in->alloc != XML_BUFFER_ALLOC_IMMUTABLE)
+		    in->content[0] = ' ';
 	    }
 	    break;
 	}