diff options
author | rmax <rmax> | 2002-07-05 11:16:01 (GMT) |
---|---|---|
committer | rmax <rmax> | 2002-07-05 11:16:01 (GMT) |
commit | 04e435eb58be31778370bb38c18952a2d6a782b1 (patch) | |
tree | 940e86bd10e97d8bf7d7b8bc2789412d194768bd /generic/tclClock.c | |
parent | a407e1e0a4496d94823146e2bacf89ba0d5634f5 (diff) | |
download | tcl-04e435eb58be31778370bb38c18952a2d6a782b1.zip tcl-04e435eb58be31778370bb38c18952a2d6a782b1.tar.gz tcl-04e435eb58be31778370bb38c18952a2d6a782b1.tar.bz2 |
* generic/tclClock.c (FormatClock): Convert the format string to
UTF8 before calling TclpStrftime, so that non-ASCII characters
don't get mangled when the result string is being converted back.
* tests/clock.test: Added a test for that.
Diffstat (limited to 'generic/tclClock.c')
-rw-r--r-- | generic/tclClock.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/generic/tclClock.c b/generic/tclClock.c index 9bf7ed0..549cc0a 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.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: tclClock.c,v 1.15 2002/05/29 00:19:40 hobbs Exp $ + * RCS: @(#) $Id: tclClock.c,v 1.16 2002/07/05 11:16:01 rmax Exp $ */ #include "tcl.h" @@ -327,13 +327,16 @@ FormatClock(interp, clockVal, useGMT, format) bufSize++; } } + Tcl_DStringInit(&uniBuffer); + Tcl_UtfToExternalDString(NULL, format, -1, &uniBuffer); Tcl_DStringInit(&buffer); Tcl_DStringSetLength(&buffer, bufSize); Tcl_MutexLock(&clockMutex); - result = TclpStrftime(buffer.string, (unsigned int) bufSize, format, - timeDataPtr, useGMT); + result = TclpStrftime(buffer.string, (unsigned int) bufSize, + Tcl_DStringValue(&uniBuffer), timeDataPtr, useGMT); Tcl_MutexUnlock(&clockMutex); + Tcl_DStringFree(&uniBuffer); #if !defined(HAVE_TM_ZONE) && !defined(WIN32) if (useGMT) { |