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--generic/tclZlib.c2
-rw-r--r--library/clock.tcl2
-rw-r--r--library/init.tcl2
-rw-r--r--library/safe.tcl7
-rw-r--r--library/tm.tcl2
-rw-r--r--unix/README2
-rwxr-xr-xunix/configure4
-rw-r--r--unix/tcl.m44
-rwxr-xr-xwin/configure3
-rw-r--r--win/tcl.m43
13 files changed, 34 insertions, 39 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 3591431..fcce215 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/generic/tclZlib.c b/generic/tclZlib.c
index e14b496..ea6a1f2 100644
--- a/generic/tclZlib.c
+++ b/generic/tclZlib.c
@@ -3945,7 +3945,7 @@ TclZlibInit(
cfg[0].key = "zlibVersion";
cfg[0].value = zlibVersion();
cfg[1].key = NULL;
- Tcl_RegisterConfig(interp, "zlib", cfg, "iso8859-1");
+ Tcl_RegisterConfig(interp, "zlib", cfg, "utf-8");
/*
* Allow command type introspection to do something sensible with streams.
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.
diff --git a/unix/README b/unix/README
index 3340dc6..3c1a207 100644
--- a/unix/README
+++ b/unix/README
@@ -91,7 +91,7 @@ How To Compile And Install Tcl:
for descriptions of the probes made available,
see http://wiki.tcl.tk/DTrace for more details
--with-encoding=ENCODING Specifies the encoding for compile-time
- configuration values. Defaults to iso8859-1,
+ configuration values. Defaults to utf-8,
which is also sufficient for ASCII.
--with-tzdata=FLAG Specifies whether to install timezone data. By
default, the configure script tries to detect
diff --git a/unix/configure b/unix/configure
index 60d60cb..62b1257 100755
--- a/unix/configure
+++ b/unix/configure
@@ -1430,7 +1430,7 @@ Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-encoding encoding for configuration values (default:
- iso8859-1)
+ utf-8)
--with-system-libtommath
use external libtommath (default: true if available,
false otherwise)
@@ -3982,7 +3982,7 @@ _ACEOF
else
-$as_echo "#define TCL_CFGVAL_ENCODING \"iso8859-1\"" >>confdefs.h
+$as_echo "#define TCL_CFGVAL_ENCODING \"utf-8\"" >>confdefs.h
fi
diff --git a/unix/tcl.m4 b/unix/tcl.m4
index 8ee17e1..9f68967 100644
--- a/unix/tcl.m4
+++ b/unix/tcl.m4
@@ -2445,14 +2445,14 @@ AC_DEFUN([SC_TCL_64BIT_FLAGS], [
AC_DEFUN([SC_TCL_CFG_ENCODING], [
AC_ARG_WITH(encoding,
AC_HELP_STRING([--with-encoding],
- [encoding for configuration values (default: iso8859-1)]),
+ [encoding for configuration values (default: utf-8)]),
with_tcencoding=${withval})
if test x"${with_tcencoding}" != x ; then
AC_DEFINE_UNQUOTED(TCL_CFGVAL_ENCODING,"${with_tcencoding}",
[What encoding should be used for embedded configuration info?])
else
- AC_DEFINE(TCL_CFGVAL_ENCODING,"iso8859-1",
+ AC_DEFINE(TCL_CFGVAL_ENCODING,"utf-8",
[What encoding should be used for embedded configuration info?])
fi
])
diff --git a/win/configure b/win/configure
index d824244..5888332 100755
--- a/win/configure
+++ b/win/configure
@@ -3749,8 +3749,7 @@ fi
_ACEOF
else
- # Default encoding on windows is not "iso8859-1"
- $as_echo "#define TCL_CFGVAL_ENCODING \"cp1252\"" >>confdefs.h
+ $as_echo "#define TCL_CFGVAL_ENCODING \"utf-8\"" >>confdefs.h
fi
diff --git a/win/tcl.m4 b/win/tcl.m4
index a8aab6b..ea23a21 100644
--- a/win/tcl.m4
+++ b/win/tcl.m4
@@ -1085,8 +1085,7 @@ AC_DEFUN([SC_TCL_CFG_ENCODING], [
if test x"${with_tcencoding}" != x ; then
AC_DEFINE_UNQUOTED(TCL_CFGVAL_ENCODING,"${with_tcencoding}")
else
- # Default encoding on windows is not "iso8859-1"
- AC_DEFINE(TCL_CFGVAL_ENCODING,"cp1252")
+ AC_DEFINE(TCL_CFGVAL_ENCODING,"utf-8")
fi
])