diff options
-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) { |