diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2024-06-24 13:11:46 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2024-06-24 13:11:46 (GMT) |
commit | d23be48f3a6736dca76952d268af703af7c46d46 (patch) | |
tree | 4d18e438c54491d535a80bbeea98ec6957d27323 | |
parent | ddce493336169758cd08cba4956c6454aed42944 (diff) | |
parent | 456646dee9a9f2c3a56100c3d7477212fd791fd9 (diff) | |
download | tcl-d23be48f3a6736dca76952d268af703af7c46d46.zip tcl-d23be48f3a6736dca76952d268af703af7c46d46.tar.gz tcl-d23be48f3a6736dca76952d268af703af7c46d46.tar.bz2 |
TIP #699: Remove support for encoding aliases {} and "binary".
-rw-r--r-- | doc/chan.n | 6 | ||||
-rw-r--r-- | generic/tclIO.c | 6 |
2 files changed, 7 insertions, 5 deletions
@@ -165,8 +165,8 @@ million, allowing buffers of up to one million bytes in size. \fB\-encoding\fR \fIname\fR . This option is used to specify the encoding of the channel as one of -the named encodings returned by \fBencoding names\fR or the special -value \fBbinary\fR, so that the data can be converted to and from +the named encodings returned by \fBencoding names\fR, so that the +data can be converted to and from Unicode for use in Tcl. For instance, in order for Tcl to read characters from a Japanese file in \fBshiftjis\fR and properly process and display the contents, the encoding would be set to \fBshiftjis\fR. @@ -177,7 +177,7 @@ automatically be converted to the specified encoding on output. .RS .PP If a file contains pure binary data (for instance, a JPEG image), the -encoding for the channel should be configured to be \fBbinary\fR. Tcl +encoding for the channel should be configured to be \fBiso8859-1\fR. Tcl will then assign no interpretation to the data in the file and simply read or write raw bytes. The Tcl \fBbinary\fR command can be used to manipulate this byte-oriented data. It is usually better to set the diff --git a/generic/tclIO.c b/generic/tclIO.c index 75a9025..fa75804 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -8225,8 +8225,10 @@ Tcl_SetChannelOption( Tcl_Encoding encoding; int profile; - if ((newValue[0] == '\0') || (strcmp(newValue, "binary") == 0)) { - encoding = Tcl_GetEncoding(NULL, "iso8859-1"); + if ((newValue[0] == '\0') || !strcmp(newValue, "binary")) { + 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; } else { encoding = Tcl_GetEncoding(interp, newValue); if (encoding == NULL) { |