From 05f6317032522fa4b68966fe3c1ef854d87fbf6e Mon Sep 17 00:00:00 2001 From: Kevin B Kenny Date: Fri, 4 Nov 2005 18:18:03 +0000 Subject: Bug 1317477 --- ChangeLog | 7 +++++++ compat/strftime.c | 32 ++++++++++++++++++++------------ 2 files changed, 27 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index d657763..629f7e0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-11-04 Kevin Kenny + + * compat/strftime.c: Fixed a problem where the name of the + time zone was double-converted from system encoding to + UTF-8. Thanks to the anonymous submitter of [Bug 1317477] + for the report and the patch. + 2005-11-04 Miguel Sofer * generic/tclInt.h: diff --git a/compat/strftime.c b/compat/strftime.c index 609c193..7d2c416 100644 --- a/compat/strftime.c +++ b/compat/strftime.c @@ -10,7 +10,7 @@ * * Changes 2002 Copyright (c) 2002 ActiveState Corporation. * - * RCS: @(#) $Id: strftime.c,v 1.10.2.2 2004/09/08 18:32:20 kennykb Exp $ + * RCS: @(#) $Id: strftime.c,v 1.10.2.3 2005/11/04 18:18:04 kennykb Exp $ */ /* @@ -47,7 +47,7 @@ */ #if defined(LIBC_SCCS) -static char *rcsid = "$Id: strftime.c,v 1.10.2.2 2004/09/08 18:32:20 kennykb Exp $"; +static char *rcsid = "$Id: strftime.c,v 1.10.2.3 2005/11/04 18:18:04 kennykb Exp $"; #endif /* LIBC_SCCS */ #include @@ -339,9 +339,11 @@ _fmt(format, t) * we must make use of the special localized calls. */ case 'c': - if (!GetDateFormat(LOCALE_USER_DEFAULT, DATE_LONGDATE, - &syst, NULL, buf, BUF_SIZ) || !_add(buf) - || !_add(" ")) { + if (!GetDateFormat(LOCALE_USER_DEFAULT, + DATE_LONGDATE | LOCALE_USE_CP_ACP, + &syst, NULL, buf, BUF_SIZ) + || !_add(buf) + || !_add(" ")) { return(0); } /* @@ -349,14 +351,18 @@ _fmt(format, t) * so continue to %X case here. */ case 'X': - if (!GetTimeFormat(LOCALE_USER_DEFAULT, 0, - &syst, NULL, buf, BUF_SIZ) || !_add(buf)) { + if (!GetTimeFormat(LOCALE_USER_DEFAULT, + LOCALE_USE_CP_ACP, + &syst, NULL, buf, BUF_SIZ) + || !_add(buf)) { return(0); } continue; case 'x': - if (!GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, - &syst, NULL, buf, BUF_SIZ) || !_add(buf)) { + if (!GetDateFormat(LOCALE_USER_DEFAULT, + DATE_SHORTDATE | LOCALE_USE_CP_ACP, + &syst, NULL, buf, BUF_SIZ) + || !_add(buf)) { return(0); } continue; @@ -385,9 +391,11 @@ _fmt(format, t) continue; case 'Z': { char *name = (isGMT ? "GMT" : TclpGetTZName(t->tm_isdst)); - if (name && !_add(name)) { - return 0; - } + int wrote; + Tcl_UtfToExternal(NULL, NULL, name, -1, 0, NULL, + pt, gsize, NULL, &wrote, NULL); + pt += wrote; + gsize -= wrote; continue; } case '%': -- cgit v0.12