Deutsch   English   Français   Italiano  
<vljno8$24ig0$1@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: Harald Oehlmann <wortkarg3@yahoo.com>
Newsgroups: comp.lang.tcl
Subject: Re: Tcl9: source files are interpreted as utf-8 by default
Date: Tue, 7 Jan 2025 18:20:08 +0100
Organization: A noiseless patient Spider
Lines: 74
Message-ID: <vljno8$24ig0$1@dont-email.me>
References: <vjhiar$3f9go$1@dont-email.me> <vljmj2$29vdo$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 07 Jan 2025 18:20:09 +0100 (CET)
Injection-Info: dont-email.me; posting-host="5cf8727bd422c46aed9cbb6e4afe058a";
	logging-data="2247168"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+idZzf62GmKsMzVo1IQXDe"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:W5pTkgEwp2UDSFxHD43EApJXNi8=
Content-Language: en-GB
In-Reply-To: <vljmj2$29vdo$1@dont-email.me>
Bytes: 3460

Am 07.01.2025 um 18:00 schrieb Uwe Schmitz:
> Sorry that I have to come back to this issue.
> 
> As stated before, we use iso8859-1 as system encoding.
> With Tcl9 we now got errors reading source files with e.g. umlauts,
> because Tcl9 interprets all sources as utf-8 by
> default. That means we have to add "-encoding iso8859-1"
> to ALL source and ALL tclsh calls in ALL scripts.
> So far, so good(or bad?).
> 
> What initially seems quite doable, looks more and more scary
> to me. First, if we ever may switch encoding to utf-8 we
> have to alter all those lines again. Either we switch them to utf-8 or
> we remove the -encoding and went back
> to the state before Tcl9.
> 
> Another point: we have MANY scripts only for development needs.
> Coded quickNdirty for code generation, documentation, packaging, etc.
> Most of them called by "tclsh helperScript.tcl ..." (they have no 
> shebang or
> whatever). They now have to be called by
> "tclsh -encoding iso8859-1 helperScript.tcl ..."
> 
> Thats a lot more typing.
> 
> Some of them have a usage message like:
> usage: tclsh helperScript.tcl arg1 arg2
> ...
> 
> Do we now have to change it to:
> usage: tclsh -encoding iso8859-1 helperScript.tcl arg1 arg2
> ...
> ?
> 
> Side note: The open command, which opens a file with the
> system encoding by default, has thankfully not changed
> in the same manner as source and tclsh :-).
> 
> Now my suggestion:
> Wouldn't it be convenient for Tcl9 to have a global switch
> (e.g. Environment variable) to get back the Tcl8 encoding
> behaviour?
> Or, isn't it best to keep the old encoding mimik in Tcl9.
> I see no advantage in the new behavior. Even if you have
> all sources in utf-8, you might also have choosen utf-8 as
> system encoding.
> 
> Do we have (or can we have) a magic comment or something else
> with which we can choose the encoding of a source file in
> the file itself?
> Python e.g. has https://peps.python.org/pep-0263/.
> 
> Maybe I’m missing something crucial...
> 
> Thanks in advance
> Uwe
> 
> 

THanks, Uwe.
Sorry, for the inconvenience.

For me, this is a big step forward.

With tcl 8.6, I always have to type:
source -encoding utf-8 script.tcl
as I don't know the system encoding.
It is not setable for me.
So, this change is a big advantage, as now, I can type:
source script.tcl.


Sorry,
Harald