From 0ba05b173fe17b05c81447c90e27573f0adcdffa Mon Sep 17 00:00:00 2001 From: stanton Date: Wed, 2 Dec 1998 21:45:33 +0000 Subject: * generic/tclCmdAH.c (Tcl_EncodingObjCmd): Changed to avoid using Tcl_DStringResult because it is not binary clean. --- generic/tclCmdAH.c | 12 ++++++++++-- 1 file 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. -- cgit v0.12