summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/encoding.n20
-rw-r--r--generic/tclIO.c2
-rw-r--r--generic/tclPosixStr.c6
3 files changed, 9 insertions, 19 deletions
diff --git a/doc/encoding.n b/doc/encoding.n
index 5aac181..e78a8e7 100644
--- a/doc/encoding.n
+++ b/doc/encoding.n
@@ -81,29 +81,13 @@ omitted then the command returns the current system encoding. The
system encoding is used whenever Tcl passes strings to system calls.
.SH EXAMPLE
.PP
-It is common practice to write script files using a text editor that
-produces output in the euc-jp encoding, which represents the ASCII
-characters as singe bytes and Japanese characters as two bytes. This
-makes it easy to embed literal strings that correspond to non-ASCII
-characters by simply typing the strings in place in the script.
-However, because the \fBsource\fR command always reads files using the
-current system encoding, Tcl will only source such files correctly
-when the encoding used to write the file is the same. This tends not
-to be true in an internationalized setting. For example, if such a
-file was sourced in North America (where the ISO8859\-1 is normally
-used), each byte in the file would be treated as a separate character
-that maps to the 00 page in Unicode. The resulting Tcl strings will
-not contain the expected Japanese characters. Instead, they will
-contain a sequence of Latin-1 characters that correspond to the bytes
-of the original string. The \fBencoding\fR command can be used to
-convert this string to the expected Japanese Unicode characters. For
-example,
+The following example converts a byte sequence in Japanese euc-jp encoding to a TCL string:
.PP
.CS
set s [\fBencoding convertfrom\fR euc-jp "\exA4\exCF"]
.CE
.PP
-would return the Unicode string
+The result is the unicode codepoint:
.QW "\eu306F" ,
which is the Hiragana letter HA.
.SH "SEE ALSO"
diff --git a/generic/tclIO.c b/generic/tclIO.c
index fcca19c..d704d29 100644
--- a/generic/tclIO.c
+++ b/generic/tclIO.c
@@ -4385,7 +4385,7 @@ Write(
ReleaseChannelBuffer(bufPtr);
if (total == 0) {
- Tcl_SetErrno(EINVAL);
+ Tcl_SetErrno(EILSEQ);
return -1;
}
break;
diff --git a/generic/tclPosixStr.c b/generic/tclPosixStr.c
index d91a9c4..ecdf652 100644
--- a/generic/tclPosixStr.c
+++ b/generic/tclPosixStr.c
@@ -158,6 +158,9 @@ Tcl_ErrnoId(void)
#ifdef EINIT
case EINIT: return "EINIT";
#endif
+#ifdef EILSEQ
+ case EILSEQ: return "EILSEQ";
+#endif
#ifdef EINPROGRESS
case EINPROGRESS: return "EINPROGRESS";
#endif
@@ -617,6 +620,9 @@ Tcl_ErrnoMsg(
#ifdef EINIT
case EINIT: return "initialization error";
#endif
+#ifdef EILSEQ
+ case EILSEQ: return "illegal byte sequence";
+#endif
#ifdef EINPROGRESS
case EINPROGRESS: return "operation now in progress";
#endif