Sujet : Re: Tcl9: source files are interpreted as utf-8 by default
De : luc (at) *nospam* sep.invalid (Luc)
Groupes : comp.lang.tclDate : 08. Jan 2025, 20:23:39
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <20250108162339.7c04023e@lud1.home>
References : 1 2 3 4 5 6 7 8 9
On Wed, 8 Jan 2025 17:04:26 -0000 (UTC), Rich wrote:
situation. If the script is iso-8859 encoded, but Tcl's default
parsing reads it as UTF-8, then all of the iso-8859 characters
inside are already corrupted *before* even the first command in the
script is executed. So there's no way to "source" a
"set_encoding.tcl" /in the main script itself/, that would adjust
the encoding before the main script is parsed using the wrong
encoding.
>
**************************
I see.
How about trading places?
Instead of main.tcl sourcing set_encoding.tcl, starter.tcl runs some
'encoding' command then sources main.tcl. Basically, a wrapper.
Do we have a cigar?
Another option is to run 'iconv' recursively on all those source files.
I did something like that some 15 years ago. But my case involved a
migration. I had a ton of legacy iso-8859 files on a system-wide
utf-8 Linux system. That caused me problems too, but iconv fixed it.
-- Luc>