summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/FileSystem.34
-rw-r--r--doc/source.n2
-rw-r--r--generic/tclIOUtil.c36
-rw-r--r--library/clock.tcl2
-rw-r--r--library/init.tcl2
-rw-r--r--library/safe.tcl7
-rw-r--r--library/tm.tcl2
7 files changed, 26 insertions, 29 deletions
diff --git a/doc/FileSystem.3 b/doc/FileSystem.3
index 6703638..4e77114 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 the utf-8 encoding
when reading the file.
.PP
\fBTcl_FSLoadFile\fR dynamically loads a binary code file into memory and
diff --git a/doc/source.n b/doc/source.n
index 353b8fb..8757cb8 100644
--- a/doc/source.n
+++ b/doc/source.n
@@ -47,7 +47,7 @@ A leading BOM (Byte order mark) contained in the file is ignored for unicode enc
.PP
The \fB\-encoding\fR option is used to specify the encoding of
the data stored in \fIfileName\fR. When the \fB\-encoding\fR option
-is omitted, the system encoding is assumed.
+is omitted, the utf-8 encoding is assumed.
.SH EXAMPLE
.PP
Run the script in the file \fBfoo.tcl\fR and then the script in the
diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c
index c413b21..2879bcb 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. */
{
int length, result = TCL_ERROR;
Tcl_StatBuf statBuf;
@@ -1722,16 +1722,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 the encoding is unknown report an error.
*/
- if (encodingName != NULL) {
- if (Tcl_SetChannelOption(interp, chan, "-encoding", encodingName)
- != TCL_OK) {
- Tcl_Close(interp,chan);
- return result;
- }
+ if (encodingName == NULL) {
+ encodingName = "utf-8";
+ }
+ if (Tcl_SetChannelOption(interp, chan, "-encoding", encodingName)
+ != TCL_OK) {
+ Tcl_Close(interp,chan);
+ return result;
}
TclNewObj(objPtr);
@@ -1821,7 +1821,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;
@@ -1858,16 +1858,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 the encoding is unknown report an error.
*/
- if (encodingName != NULL) {
- if (Tcl_SetChannelOption(interp, chan, "-encoding", encodingName)
- != TCL_OK) {
- Tcl_Close(interp,chan);
- return TCL_ERROR;
- }
+ if (encodingName == NULL) {
+ encodingName = "utf-8";
+ }
+ if (Tcl_SetChannelOption(interp, chan, "-encoding", encodingName)
+ != TCL_OK) {
+ Tcl_Close(interp, chan);
+ return TCL_ERROR;
}
TclNewObj(objPtr);
diff --git a/library/clock.tcl b/library/clock.tcl
index 2e42a98..54919f2 100644
--- a/library/clock.tcl
+++ b/library/clock.tcl
@@ -3314,7 +3314,7 @@ proc ::tcl::clock::LoadTimeZoneFile { fileName } {
"time zone \":$fileName\" not valid"
}
try {
- source -encoding utf-8 [file join $DataDir $fileName]
+ source [file join $DataDir $fileName]
} on error {} {
return -code error \
-errorcode [list CLOCK badTimeZone :$fileName] \
diff --git a/library/init.tcl b/library/init.tcl
index 16d5d67..09dd6a4 100644
--- a/library/init.tcl
+++ b/library/init.tcl
@@ -112,7 +112,7 @@ if {[interp issafe]} {
foreach cmd {add format scan} {
proc ::tcl::clock::$cmd args {
variable TclLibDir
- source -encoding utf-8 [file join $TclLibDir clock.tcl]
+ source [file join $TclLibDir clock.tcl]
return [uplevel 1 [info level 0]]
}
}
diff --git a/library/safe.tcl b/library/safe.tcl
index 1f8c3d2..4c0f3b1 100644
--- a/library/safe.tcl
+++ b/library/safe.tcl
@@ -937,7 +937,7 @@ proc ::safe::AliasSource {child args} {
}
} else {
set at 0
- set encoding {}
+ set encoding utf-8
}
if {$argc != 1} {
set msg "wrong # args: should be \"source ?-encoding E? fileName\""
@@ -980,10 +980,7 @@ proc ::safe::AliasSource {child args} {
set replacementMsg "script error"
set code [catch {
set f [open $realfile]
- fconfigure $f -eofchar \032
- if {$encoding ne ""} {
- fconfigure $f -encoding $encoding
- }
+ fconfigure $f -encoding $encoding -eofchar \032
set contents [read $f]
close $f
::interp eval $child [list info script $file]
diff --git a/library/tm.tcl b/library/tm.tcl
index c60084c..3c0ec22 100644
--- a/library/tm.tcl
+++ b/library/tm.tcl
@@ -267,7 +267,7 @@ proc ::tcl::tm::UnknownHandler {original name args} {
# of the package file is the last element in the list.
package ifneeded $pkgname $pkgversion \
- "[::list package provide $pkgname $pkgversion];[::list source -encoding utf-8 $file]"
+ "[::list package provide $pkgname $pkgversion];[::list source $file]"
# We abort in this unknown handler only if we got a
# satisfying candidate for the requested package.