Rocksolid Light

News from da outaworlds

mail  files  register  groups  login

Message-ID:  

Tomorrow will be cancelled due to lack of interest.


comp / comp.lang.tcl / Re: info hostname containing umlaut on Windows

SubjectAuthor
* info hostname containing umlaut on WindowsRalf Fassel
`* Re: info hostname containing umlaut on WindowsHarald Oehlmann
 `- Re: info hostname containing umlaut on WindowsRalf Fassel

1
Subject: info hostname containing umlaut on Windows
From: Ralf Fassel
Newsgroups: comp.lang.tcl
Date: Wed, 22 May 2024 14:24 UTC
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: ralfixx@gmx.de (Ralf Fassel)
Newsgroups: comp.lang.tcl
Subject: info hostname containing umlaut on Windows
Date: Wed, 22 May 2024 16:24:18 +0200
Lines: 49
Message-ID: <ygao78xsz59.fsf@akutech.de>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Trace: individual.net fZDdv7aqx97f8iP2fxV/Vw2M9aIFnj1qrs62AePoOdp0dVbAU=
Cancel-Lock: sha1:myGZRrkIH287KcC/IQIbEDZqu2A= sha1:bony6c9jRwLyuELgmnZlioO/Gpo= sha256:0V2sWtipq5jb0RoFaD+P3VR4IJ6/JHDkU4+Onpma/d0=
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
View all headers

tcl 8.6.14 (self-compiled from source), Windows 11,
hostname contains an Umlaut: foo-läptop (Umlaut-a)

% wish8.6
% info hostname
foo-läptop
% info hostname
foo-läpt

The second time, the hostname is encoded another time.

Looking at the code for [info hostname] on Windows, it seems to me:

- information is stored in global variable
static ProcessGlobalValue hostName =
{0, 0, NULL, NULL, InitializeHostName, NULL, NULL};
(win/tclWinSock.c)

- the first time the information is retrieved by
TclGetProcessGlobalValue(), it is initialized by a
call to InitializeHostName(), which sets the encoding of the
information to utf-8 after retrieving it from windows and converting
it to utf-8
*encodingPtr = Tcl_GetEncoding(NULL, "utf-8");
(win/tclWinSock.c)

- the next time the information is retrieved by
TclGetProcessGlobalValue(), it sees that the encoding is non-NULL and
compares it to the system encoding, which on Windows is not utf-8, but
(in my case) cp1252. So the information is converted again.

TclGetProcessGlobalValue()
...
if (pgvPtr->encoding) {
Tcl_Encoding current = Tcl_GetEncoding(NULL, NULL);

if (pgvPtr->encoding != current) {
/*
* The system encoding has changed since the global string value
* was saved. Convert the global value to be based on the new
* system encoding.
*/

// !! wrong for [info hostname]

Can someone comfirm this?

R'

Subject: Re: info hostname containing umlaut on Windows
From: Harald Oehlmann
Newsgroups: comp.lang.tcl
Organization: A noiseless patient Spider
Date: Wed, 22 May 2024 15:51 UTC
References: 1
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: wortkarg3@yahoo.com (Harald Oehlmann)
Newsgroups: comp.lang.tcl
Subject: Re: info hostname containing umlaut on Windows
Date: Wed, 22 May 2024 17:51:46 +0200
Organization: A noiseless patient Spider
Lines: 56
Message-ID: <v2l4ai$18aan$1@dont-email.me>
References: <ygao78xsz59.fsf@akutech.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 22 May 2024 17:51:47 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="3792ced259c092a6a479131e569ef461";
logging-data="1321303"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19c8gAASVmflVJVu+oNFLd9"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:gjz1WbTYtnUMbLsnNbSCDgQLQlY=
Content-Language: en-GB
In-Reply-To: <ygao78xsz59.fsf@akutech.de>
View all headers

Am 22.05.2024 um 16:24 schrieb Ralf Fassel:
> tcl 8.6.14 (self-compiled from source), Windows 11,
> hostname contains an Umlaut: foo-läptop (Umlaut-a)
>
> % wish8.6
> % info hostname
> foo-läptop
> % info hostname
> foo-läpt
>
> The second time, the hostname is encoded another time.
>
> Looking at the code for [info hostname] on Windows, it seems to me:
>
> - information is stored in global variable
> static ProcessGlobalValue hostName =
> {0, 0, NULL, NULL, InitializeHostName, NULL, NULL};
> (win/tclWinSock.c)
>
> - the first time the information is retrieved by
> TclGetProcessGlobalValue(), it is initialized by a
> call to InitializeHostName(), which sets the encoding of the
> information to utf-8 after retrieving it from windows and converting
> it to utf-8
> *encodingPtr = Tcl_GetEncoding(NULL, "utf-8");
> (win/tclWinSock.c)
>
> - the next time the information is retrieved by
> TclGetProcessGlobalValue(), it sees that the encoding is non-NULL and
> compares it to the system encoding, which on Windows is not utf-8, but
> (in my case) cp1252. So the information is converted again.
>
> TclGetProcessGlobalValue()
> ...
> if (pgvPtr->encoding) {
> Tcl_Encoding current = Tcl_GetEncoding(NULL, NULL);
>
> if (pgvPtr->encoding != current) {
> /*
> * The system encoding has changed since the global string value
> * was saved. Convert the global value to be based on the new
> * system encoding.
> */
>
> // !! wrong for [info hostname]
>
>
> Can someone comfirm this?
>
> R'

Great observation. File a bug to discuss there.

Thanks,
Harald

Subject: Re: info hostname containing umlaut on Windows
From: Ralf Fassel
Newsgroups: comp.lang.tcl
Date: Wed, 22 May 2024 16:33 UTC
References: 1 2
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: ralfixx@gmx.de (Ralf Fassel)
Newsgroups: comp.lang.tcl
Subject: Re: info hostname containing umlaut on Windows
Date: Wed, 22 May 2024 18:33:17 +0200
Lines: 19
Message-ID: <ygajzjlst6a.fsf@akutech.de>
References: <ygao78xsz59.fsf@akutech.de> <v2l4ai$18aan$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Trace: individual.net uJaCTdFFgWdSsl6JytXgOwhgoLPwUx+ZPydY1Wl78r6Qhqbw4=
Cancel-Lock: sha1:XFFJSWr4ShnfuPf6SrPRCI6H4Pg= sha1:FyLACqz8JdO6xP4rR6id8t+KWEY= sha256:sw3nyUFsMpZmqhqfus9q4VLS2Y43oJeONkEK1j706U0=
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
View all headers

* Harald Oehlmann <wortkarg3@yahoo.com>
| Am 22.05.2024 um 16:24 schrieb Ralf Fassel:
| > tcl 8.6.14 (self-compiled from source), Windows 11,
| > hostname contains an Umlaut: foo-läptop (Umlaut-a)
| > % wish8.6
| > % info hostname
| > foo-läptop
| > % info hostname
| > foo-läpt
| > The second time, the hostname is encoded another time.
--<snip-snip>--

>
| Great observation. File a bug to discuss there.

[x] done.
https://core.tcl-lang.org/tcl/tktview/3fc3287497a7e281b96661f883c20e0e74a0fca7

R'

1

rocksolid light 0.9.8
clearnet tor