summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstanton <stanton>1998-12-02 21:45:33 (GMT)
committerstanton <stanton>1998-12-02 21:45:33 (GMT)
commit0ba05b173fe17b05c81447c90e27573f0adcdffa (patch)
treecba606b2576cbd1af5ece668cd67b630190c7d18
parent32a79b2ff96bfafd432e5aa9c1de68fdaa028544 (diff)
downloadtcl-0ba05b173fe17b05c81447c90e27573f0adcdffa.zip
tcl-0ba05b173fe17b05c81447c90e27573f0adcdffa.tar.gz
tcl-0ba05b173fe17b05c81447c90e27573f0adcdffa.tar.bz2
* generic/tclCmdAH.c (Tcl_EncodingObjCmd): Changed to avoid using
Tcl_DStringResult because it is not binary clean.
-rw-r--r--generic/tclCmdAH.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/generic/tclCmdAH.c b/generic/tclCmdAH.c
index f77072e..0658e5c 100644
--- a/generic/tclCmdAH.c
+++ b/generic/tclCmdAH.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclCmdAH.c,v 1.1.2.6 1998/11/11 04:54:07 stanton Exp $
+ * RCS: @(#) $Id: tclCmdAH.c,v 1.1.2.7 1998/12/02 21:45:33 stanton Exp $
*/
#include "tclInt.h"
@@ -478,7 +478,15 @@ Tcl_EncodingObjCmd(dummy, interp, objc, objv)
string = (char *) Tcl_GetByteArrayFromObj(data, &length);
Tcl_ExternalToUtfDString(encoding, string, length, &ds);
- Tcl_DStringResult(interp, &ds);
+
+ /*
+ * Note that we cannot use Tcl_DStringResult here because
+ * it will truncate the string at the first null byte.
+ */
+
+ Tcl_SetStringObj(Tcl_GetObjResult(interp),
+ Tcl_DStringValue(&ds), Tcl_DStringLength(&ds));
+ Tcl_DStringFree(&ds);
} else {
/*
* Store the result as binary data.