summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/FileSystem.34
-rw-r--r--generic/tclIOUtil.c36
2 files changed, 20 insertions, 20 deletions
diff --git a/doc/FileSystem.3 b/doc/FileSystem.3
index 681e834..856a05d 100644
--- a/doc/FileSystem.3
+++ b/doc/FileSystem.3
@@ -414,7 +414,7 @@ caller (with a reference count of 0).
the encoding identified by \fIencodingName\fR and evaluates
its contents as a Tcl script. It returns the same information as
\fBTcl_EvalObjEx\fR.
-If \fIencodingName\fR is NULL, the system encoding is used for
+If \fIencodingName\fR is NULL, the utf-8 encoding is used for
reading the file contents.
If the file could not be read then a Tcl error is returned to describe
why the file could not be read.
@@ -430,7 +430,7 @@ or
which will be safely substituted by the Tcl interpreter into
.QW ^Z .
\fBTcl_FSEvalFile\fR is a simpler version of
-\fBTcl_FSEvalFileEx\fR that always uses the system encoding
+\fBTcl_FSEvalFileEx\fR that always uses utf-8
when reading the file.
.PP
\fBTcl_FSLoadFile\fR dynamically loads a binary code file into memory and
diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c
index 3d6c47e..5811f62 100644
--- a/generic/tclIOUtil.c
+++ b/generic/tclIOUtil.c
@@ -1684,7 +1684,7 @@ Tcl_FSEvalFileEx(
* Tilde-substitution is performed on this
* pathname. */
const char *encodingName) /* Either the name of an encoding or NULL to
- use the system encoding. */
+ use the utf-8 encoding. */
{
size_t length;
int result = TCL_ERROR;
@@ -1723,16 +1723,16 @@ Tcl_FSEvalFileEx(
/*
* If the encoding is specified, set the channel to that encoding.
- * Otherwise don't touch it, leaving things up to the system encoding. If
- * the encoding is unknown report an error.
+ * Otherwise use utf-8.
*/
- if (encodingName != NULL) {
- if (Tcl_SetChannelOption(interp, chan, "-encoding", encodingName)
- != TCL_OK) {
- Tcl_CloseEx(interp,chan,0);
- return result;
- }
+ if (encodingName == NULL) {
+ encodingName = "utf-8";
+ }
+ if (Tcl_SetChannelOption(interp, chan, "-encoding", encodingName)
+ != TCL_OK) {
+ Tcl_CloseEx(interp,chan,0);
+ return result;
}
TclNewObj(objPtr);
@@ -1822,7 +1822,7 @@ TclNREvalFile(
* evaluate. Tilde-substitution is performed on
* this pathname. */
const char *encodingName) /* The name of an encoding to use, or NULL to
- * use the system encoding. */
+ * use the utf-8 encoding. */
{
Tcl_StatBuf statBuf;
Tcl_Obj *oldScriptFile, *objPtr;
@@ -1859,16 +1859,16 @@ TclNREvalFile(
/*
* If the encoding is specified, set the channel to that encoding.
- * Otherwise don't touch it, leaving things up to the system encoding. If
- * the encoding is unknown report an error.
+ * Otherwise use utf-8.
*/
- if (encodingName != NULL) {
- if (Tcl_SetChannelOption(interp, chan, "-encoding", encodingName)
- != TCL_OK) {
- Tcl_CloseEx(interp, chan, 0);
- return TCL_ERROR;
- }
+ if (encodingName == NULL) {
+ encodingName = "utf-8";
+ }
+ if (Tcl_SetChannelOption(interp, chan, "-encoding", encodingName)
+ != TCL_OK) {
+ Tcl_CloseEx(interp, chan, 0);
+ return TCL_ERROR;
}
TclNewObj(objPtr);