*
[email protected] (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'
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)