Skip to content
Tcl Source Code Artifact [46d34456e6]
Login

Artifact [46d34456e6]

Artifact 46d34456e6e7fc64b45f01f3cd9979234725a9ba2e2dbad85ca99730d83542dd:

Ticket change [46d34456e6] - Ticket [3fc3287497a7e281|3fc3287497] <i>TclGetProcessGlobalValue encodes information twice on Windows</i> status still Open with 3 other changes by ralfixx on 2024-05-22 17:22:07.
D 2024-05-22T17:22:07.610
J comment If\sthe\shostname\son\sWindows\scontains\san\sUmlaut,\s[info\shostname]\swill\sreturn\sa\sdifferent\svalue\swhen\sinvoked\sfor\sthe\ssecond\stime:\r\n\r\n\s\s\s\s%\stclsh8.6\r\n\s\s\s\s%\sinfo\shostname\r\n\s\s\s\sfoo-läptop\r\n\s\s\s\s%\sinfo\shostname\r\n\s\s\s\sfoo-läpt\r\n\r\nBUG:\sThe\ssecond\stime,\sthe\shostname\sis\sencoded\sanother\stime.\r\n\r\nLooking\sat\sthe\scode\sfor\s[info\shostname]\son\sWindows,\sit\sseems\sto\sme:\r\n\r\n-\sinformation\sis\sstored\sin\sglobal\svariable\r\n\s\s\s\sstatic\sProcessGlobalValue\shostName\s=\r\n\s\s\s\s\t{0,\s0,\sNULL,\sNULL,\sInitializeHostName,\sNULL,\sNULL};\r\n\s\s(win/tclWinSock.c)\r\n\s\s\r\n-\sthe\sfirst\stime\sthe\sinformation\sis\sretrieved\sby\r\n\s\sTclGetProcessGlobalValue(),\sit\sis\sinitialized\sby\sa\r\n\s\scall\sto\sInitializeHostName(),\swhich\ssets\sthe\sencoding\sof\sthe\r\n\s\sinformation\sto\sutf-8\safter\sretrieving\sit\sfrom\swindows\sand\sconverting\r\n\s\sit\sto\sutf-8\r\n\s\s\s\s\s\s\s\s*encodingPtr\s=\sTcl_GetEncoding(NULL,\s"utf-8");\r\n\s\s(win/tclWinSock.c)\r\n\s\s\r\n-\sthe\snext\stime\sthe\sinformation\sis\sretrieved\sby\r\n\s\sTclGetProcessGlobalValue(),\sit\ssees\sthat\sthe\sencoding\sis\snon-NULL\sand\r\n\s\scompares\sit\sto\sthe\ssystem\sencoding,\swhich\son\sWindows\sis\snot\sutf-8,\sbut\r\n\s\s(in\smy\scase)\scp1252.\s\sSo\sthe\sinformation\sis\sconverted\sagain.\r\n\r\n\s\sTclGetProcessGlobalValue()\r\n\s\s\s\s...\r\n\s\s\s\sif\s(pgvPtr->encoding)\s{\r\n\tTcl_Encoding\scurrent\s=\sTcl_GetEncoding(NULL,\sNULL);\r\n\r\n\tif\s(pgvPtr->encoding\s!=\scurrent)\s{\r\n\r\nThis\sis\sdue\sto\sa\swrong\sfirst\sargument\sto\sTcl_UtfToExternalDString()\s\r\nin\sTclGetProcessGlobalValue()\sin\sgeneric/tclUtil.c:\r\n\r\n#4287\t\s\s\s\sTcl_UtfToExternalDString(pgvPtr->encoding,\spgvPtr->value,\r\n\t\t\s\s\s\spgvPtr->numBytes,\s&native);\r\n\r\nThe\sfirst\sargument\sis\sthe\sencoding\sto\sconvert\sTO,\snot\sconvert\sFROM.\r\n\r\nI\sfirst\sthought\sthat\sTCL9\shad\sthis\sfixed\sby\susing\sNULL\sas\sfirst\sargument,\sbut\sit\sactually\shasn't.\r\n\r\nFor\sa\spossible\spatch\ssee\snext\scomment.
J login ralfixx
J mimetype text/plain
K 3fc3287497a7e281b96661f883c20e0e74a0fca7
U ralfixx
Z 627adfd79fea926a2b9da4bcb05f013f