Re: Tcl 8.6 vs 9.0 encoding plus some general confusion

Liste des GroupesRevenir à cl tcl 
Sujet : Re: Tcl 8.6 vs 9.0 encoding plus some general confusion
De : ralfixx (at) *nospam* gmx.de (Ralf Fassel)
Groupes : comp.lang.tcl
Date : 23. Jun 2025, 11:06:16
Autres entêtes
Message-ID : <ygaqzzaai1z.fsf@akutech.de>
References : 1
User-Agent : Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
* ted@loft.tnolan.com (Ted Nolan <tednolan>)
| However the warning thrown by 9.0 points me to the "chan"
| man page which says for the "-encoding" option:
>
| If a file contains pure binary data (for instance, a JPEG
| image), the encoding for the channel should be configured
| to be iso8859-1. Tcl will then assign no interpretation to
| the data in the file and simply read or write raw bytes.
| The Tcl binary command can be used to manipulate this
| byte-oriented data. It is usually better to set the
| -translation option to binary when you want to transfer
| binary data, as this turns off the other automatic
| interpretations of the bytes in the stream as well.
>
| and I don't understand this at all.  If I say "-encoding iso8859-1",
| am I not saying that the data is textual, and that Tcl should parse
| it from "iso8859-1" into the internal Unicode as it reads it?

Looking at the TCL sources for 9.0 and 8.6, it seems that the 'binary'
encoding always has been an alias for 'iso8859-1', which has finally
been removed in TCL 9, cf. changes.md:

    ## Notable incompatibilities
     - Removed the encoding alias `binary` to `iso8859-1`.

The code in tcl8.6 has several places where in the encoding context
'binary' finally ends up as 'iso8859-1' (tclIO.c, static Tcl_Encoding
GetBinaryEncoding(void) => tsdPtr->binaryEncoding = Tcl_GetEncoding(NULL, "iso8859-1");)

The code in tcl9.0.1 has

if ((newValue[0] == '\0') || !strcmp(newValue, "binary")) {
    if (interp) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"unknown encoding \"%s\": No longer supported.\n"
"\tplease use either \"-translation binary\" "
"or \"-encoding iso8859-1\"", newValue));
    }
    return TCL_ERROR;
}
i.e. raise an error if the encoding is set to "binary".

Effectively nothing should have changed, except you can no longer
say
   chan -encoding binary
in tcl 9 (should have used "-translation binary" anyway).

HTH
R'

Date Sujet#  Auteur
22 Jun 25 * Tcl 8.6 vs 9.0 encoding plus some general confusion6ted@loft.tnolan.com (Ted Nolan
23 Jun 25 `* Re: Tcl 8.6 vs 9.0 encoding plus some general confusion5Ralf Fassel
23 Jun 25  `* Re: Tcl 8.6 vs 9.0 encoding plus some general confusion4Rich
23 Jun 25   +* Re: Tcl 8.6 vs 9.0 encoding plus some general confusion2Ralf Fassel
24 Jun 25   i`- Re: Tcl 8.6 vs 9.0 encoding plus some general confusion1Harald Oehlmann
24 Jun 25   `- Re: Tcl 8.6 vs 9.0 encoding plus some general confusion1Harald Oehlmann

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal