Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2025-05-21
10:01 • New ticket [c776eb586d] "encoding user": wrong answer with UTF-8 setti... artifact: 732b3d8ea2 user: jan.nijtmans
2025-05-06
08:06 • Closed ticket [8ffd8cabd1]: "encoding system": wrong result without m... artifact: fec22f4855 user: jan.nijtmans
07:42
Fix [8ffd8cabd1]: "encoding system": wrong result without manifest check-in: cd024d90d9 user: jan.nijtmans tags: core-9-0-branch
2025-05-05
16:50 • Ticket [8ffd8cabd1] "encoding system": wrong result without manifest<... artifact: 1dfe7b1372 user: oehhar
16:37 • Ticket [8ffd8cabd1]: 3 changes artifact: 1785910391 user: jan.nijtmans
11:22
Rebase (makes use of [8ffd8cabd1]) check-in: de117edb03 user: jan.nijtmans tags: encoding-user
10:09 • Ticket [8ffd8cabd1] "encoding system": wrong result without manifest<... artifact: 83077e23e9 user: oehhar
10:01 • Ticket [8ffd8cabd1]: 3 changes artifact: 0401409e2a user: jan.nijtmans
09:49 • Ticket [8ffd8cabd1]: 4 changes artifact: bcb08bf9c1 user: oehhar
09:26 • Ticket [8ffd8cabd1]: 3 changes artifact: f113ea48e1 user: jan.nijtmans
09:14
Proposed fix for [8ffd8cabd1]: "encoding system": wrong result without manifest Extracted from TIP 7... closed check-in: 4f085c4141 user: jan.nijtmans tags: bug-8ffd8cabd1
09:06 • Ticket [8ffd8cabd1] "encoding system": wrong result without manifest<... artifact: 5b2d07020d user: oehhar
08:37 • New ticket [8ffd8cabd1]. artifact: 22d7139a39 user: jan.nijtmans

"encoding system": wrong result without manifest

Closed / Fixed8ffd8cabd10e936228f73e082d8d72eb874a2fbeCreated 2 years agoUpdated 2 years ago
Descriptionwiki2025-05-05 08:37:16
The windows "tcl90.dll" can be linked into other applications than only tclsh and wish. Doing that, if the other application doesn't use a manifest, "encoding sytem" gives the wrong answer.

Example: people using the DB2 database use that, because the DB2 dll cannot handle the "utf-8" encoding. Removing the "UTF-8" setting in the manifest is a workaround, possibly resulting in encoding problems all around Tcl. The wrong answer for "system encoding" is the worst of those problem, which can easily be solved. That's the purpose of this ticket.

This can be demonstrated by building Tk, but removing the UTF-8 setting from the manifest. Demo:

    >.\tclsh90.exe
    % encoding system
    utf-8
    % exit
    >.\wish90.exe
    % encoding system
    cp1252
    % exit

Note that the "tcl90.dll" file used by tclsh90 and wish90 is identical in this example.

Since the default encoding on Windows starting with Tcl 9.0 is supposed to be UTF-8, this can result in encoding problems, when Tcl and Tk (in this example) are exchanging files.

Referenced by4
  • 732b3d8ea2New ticket [c776eb586d] "encoding user": wrong answer with UTF-8 setting in manifest. ticket2025-05-21 10:01:32
  • cd024d90d9Fix [8ffd8cabd1]: "encoding system": wrong result without manifest check-in2025-05-06 07:42:52
  • de117edb03Rebase (makes use of [8ffd8cabd1]) check-in2025-05-05 11:22:33
  • 4f085c4141Proposed fix for [8ffd8cabd1]: "encoding system": wrong result without manifest Extracted from TIP 716 implementation check-in2025-05-05 09:14:42
oehharwiki2025-05-05 09:06:58

Jan, thanks for looking into this so deeply.

I second, that the TCL library should be agnostic on the manifest. "system encoding = utf8" and "encoding user = cp1252" should not depend on the manifest.

Even for tcl or wish, we may have two alternate builds, one with the UTF-8 manifest, one without it.

The utf-8 in the manifest:

  • is good to make some 3rd party software magically utf-8 aware
  • is bad as it magically breaks some 3rd party software

Tcl and Tk should not at all depend on it.

Harald

jan.nijtmanswiki2025-05-05 09:26:13

Proposed fix [here]. It's extracted from the TIP #617 implementation, a part which I agree with that should be done.

I have some problems with some parts of TIP #716. They can be addressed, but the current TIP's still contains too meany questions. So it will still take time.

This ticket is meant to - at least - accept a small part from TIP #716 which is not controversial. It already helps the DB2 people: If they build their own tclsh, it will at least use the utf-8 encoding as default, as do Tcl 9.0.0/9.0.1

oehharwiki2025-05-05 09:49:54

Hi Jan, thanks, great. May I ask, why utf-8 is only reported as system encoding for Windows Version after Windows10 2019H1?

Was this the first version, where the manifest magic got active and thus, the "encoding system" changed to utf-8?

So, on Windows 8, we still have "encoding system=cp1252"?

Harald

jan.nijtmansplain2025-05-05 10:01:20
> So, on Windows 8, we still have "encoding system=cp1252"?

Yes, that's true. I wouldn't be surprised if Windows 8 has incomplete support for utf-8, so I'm afraid that changing the "encoding system" on machines < Windows10 2019H1 to "UTF-8" would be problematic anyway.

It's the same on UNIX: Running Tcl 9.0 on a machine which doesn't have the UTF-8 encoding as default, Tcl 9.0 will still use the ISO-8859-1 encoding.

I hope that for Tcl 9.1, Windows10 2019H1 will be set as the minimum supported version. Then we don't have to worry about this any more.
oehharwiki2025-05-05 10:09:12

Ok, thanks for the Info. I always tested Unicode support by Tcl 8.6 on Windows in a limitted way, e.g. file names with Chinese characters and Tk entry and label widgets. I don't remeber when there were issues. Anybody understands, that non BMP are an issue. I avoid to use that anyway. This all worked on Windows 8 now for a long time. I don't have a system each day, but in the office, there is one.

Thanks for all, Harald

jan.nijtmanswiki2025-05-05 16:37:34

@Harald, thanks for your support!

Any objection, merging this to core-9-0-branch and trunk?

oehharwiki2025-05-05 16:50:22

Yes, please merge. And thanks to Ashok for the code, I suppose ;-)

Harald

jan.nijtmanswiki2025-05-06 08:06:13

Fixed [here].

Thanks, Ashok, for the code!

Log in (anonymous is fine) to add a comment.