Overview
| Artifact ID: | d5a20a6c8fdf9bf78221e6a7c8f4b9552518d545f2fbd413e59c1d0eeeed820e |
|---|---|
| Ticket: | 5fca83d78cf37b70d3e958897b542f985f2ce56a
[encoding system] is wrong in an ISO-8859-1 locale |
| User & Date: | bhaible on 2024-07-01 18:34:20 |
Changes
- assignee changed to: "nobody"
- closer changed to: "nobody"
- cmimetype changed to: "text/plain"
- comment changed to:
On a Linux/glibc system, I have two French locales: $ LC_ALL=fr_FR.UTF-8 locale charmap UTF-8 $ LC_ALL=fr_FR.ISO-8859-1 locale charmap ISO-8859-1 ('locale charmap' is the command-line equivalent of nl_langinfo(CODESET).) In Tcl, [encoding system] should be set to an equivalent value, otherwise strings with non-ASCII characters are printed incorrectly to standard output. This works in Tcl 8.6: $ LC_ALL=fr_FR.UTF-8 tclsh8.6 % encoding system utf-8 $ LC_ALL=fr_FR.ISO-8859-1 tclsh8.6 % encoding system iso8859-1 But it does not work for the ISO-8859-1 locale any more in Tcl 9.0 beta2: $ LC_ALL=fr_FR.UTF-8 tclsh9.0 % encoding system utf-8 $ LC_ALL=fr_FR.ISO-8859-1 tclsh9.0 % encoding system utf-8 I debugged it. nl_langinfo(CODESET) comes out as "ISO-8859-1". This string is lowercased, producing "iso-8859-1", and then a lookup in LocaleTable is done, in function SearchKnownEncodings. The table happens to have 174 elements, and the "iso-8859-1" is at index 80. Due to a logic bug in function SearchKnownEncodings, this index is not found. SearchKnownEncodings then returns NULL. The attached patch fixes the bug. The bug is present since 2005, but triggered on different encodings, because of the influence of the table length and the searched entry's index. - foundin changed to: "9.0b2"
- is_private changed to: "0"
- login: "bhaible"
- priority changed to: "5 Medium"
- private_contact changed to: "2233330cf6146dcc3447bbdcc73be6c76b5b8e35"
- resolution changed to: "None"
- severity changed to: "Important"
- status changed to: "Open"
- submitter changed to: "bhaible"
- subsystem changed to: "38. Init - Library - Autoload"
- title changed to: "[encoding system] is wrong in an ISO-8859-1 locale"
- type changed to: "Patch"