From bd6ef46ac1eac8105c432e3ae7fb7addd1efdc07 Mon Sep 17 00:00:00 2001 From: Kevin B Kenny Date: Thu, 13 Feb 2003 23:49:47 +0000 Subject: Added conversion from the system encoding to tcl_platform(user), so that it works with non-ASCII7 user names. [Bug 685926] --- ChangeLog | 6 ++++++ win/tclWinInit.c | 14 +++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2b50690..a47965f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2003-02-13 Kevin Kenny + * win/tclWinInit.c: Added conversion from the system encoding + to tcl_platform(user), so that it works with non-ASCII7 user names. + [Bug 685926] + +2003-02-13 Kevin Kenny + * doc/tclsh.1: Added language to describe the handling of the end-of-file character \u001a embedded in a script file. [Bug 685485] diff --git a/win/tclWinInit.c b/win/tclWinInit.c index bdfbc8f..a61d59a 100644 --- a/win/tclWinInit.c +++ b/win/tclWinInit.c @@ -7,12 +7,13 @@ * Copyright (c) 1998-1999 by Scriptics Corporation. * All rights reserved. * - * RCS: @(#) $Id: tclWinInit.c,v 1.38 2003/02/04 17:06:53 vincentdarley Exp $ + * RCS: @(#) $Id: tclWinInit.c,v 1.39 2003/02/13 23:49:48 kennykb Exp $ */ #include "tclWinInt.h" #include #include +#include /* * The following declaration is a workaround for some Microsoft brain damage. @@ -597,6 +598,8 @@ TclpSetVariables(interp) OemId *oemId; OSVERSIONINFOA osInfo; Tcl_DString ds; + TCHAR szUserName[ UNLEN+1 ]; + DWORD dwUserNameLen; osInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA); GetVersionExA(&osInfo); @@ -663,11 +666,12 @@ TclpSetVariables(interp) * faster than asking the system. */ - Tcl_DStringSetLength(&ds, 100); + Tcl_DStringInit( &ds ); if (TclGetEnv("USERNAME", &ds) == NULL) { - if (GetUserName(Tcl_DStringValue(&ds), (LPDWORD) &Tcl_DStringLength(&ds)) == 0) { - Tcl_DStringSetLength(&ds, 0); - } + + if ( GetUserName( szUserName, &dwUserNameLen ) != 0 ) { + Tcl_WinTCharToUtf( szUserName, dwUserNameLen, &ds ); + } } Tcl_SetVar2(interp, "tcl_platform", "user", Tcl_DStringValue(&ds), TCL_GLOBAL_ONLY); -- cgit v0.12