Tcl Source Code

View Ticket
Login
2025-05-23
02:20 Closed ticket [c776eb586d]: "encoding user": wrong answer with UTF-8 setting in manifest plus 6 other changes artifact: 65784ec273 user: apnadkarni
02:18
Fix [c776eb586d]. Read codepage from registry (reported by Jan) check-in: 77971ca3f2 user: apnadkarni tags: tip-716
2025-05-21
13:57 Ticket [c776eb586d] "encoding user": wrong answer with UTF-8 setting in manifest status still Open with 3 other changes artifact: 38c6413096 user: apnadkarni
10:01 New ticket [c776eb586d]. artifact: 732b3d8ea2 user: jan.nijtmans

Ticket UUID: c776eb586d08c2f74ea462946b187e12ac182f0a
Title: "encoding user": wrong answer with UTF-8 setting in manifest
Type: Bug Version: TIP #716
Submitter: jan.nijtmans Created on: 2025-05-21 10:01:32
Subsystem: 52. Portability Support Assigned To: nobody
Priority: 5 Medium Severity: Important
Status: Closed Last Modified: 2025-05-23 02:20:31
Resolution: Fixed Closed By: apnadkarni
    Closed on: 2025-05-23 02:20:31
Description:

Just like [8ffd8cabd1], we expect all Tcl commands to give the same answer, whether the UTF-8 setting is available in the manifest or not.

Let's see if TIP #716 adhers to that:

>.\tclsh90
% tcl::build-info
9.0.2+af16c07b81655fabde8028374161ad54b84ef9956843c63f49976b4ef601b611.gcc-1002
% encoding user
cp1252
% exit

>.\wish90 % tcl::build-info 9.0.2+af16c07b81655fabde8028374161ad54b84ef9956843c63f49976b4ef601b611.gcc-1002 % encoding user utf-8 % exit

We expect the same answer (cp1252) in both cases. If tcl90.dll is embedded in R, the same will happen in that environment (using wish90 here is just for demo purposes).

Note that wish90 has the UTF-8 setting in the manifest, tclsh90 has not (it's the TIP #716 implementation). The tcl dll (tcl90.dll) is the same in both cases.

TIP #718 doesn't have this problem, because it reads value from the registry directly in stead of depending on the getACP() function (which is the cause of the problem here).

User Comments: apnadkarni added on 2025-05-23 02:20:31:
Fixed in [77971ca3f2]. Note by design, registry is read only once for consistency with Windows where code page does not change in a running process even if registry changes.

apnadkarni added on 2025-05-21 13:57:17:
Good point. Agree that looking up the registry is the preferred method.