summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2020-10-22 10:30:05 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2020-10-22 10:30:05 (GMT)
commit33918a2b0b4bd10fb1defc2f141b73d20565f40a (patch)
tree902e0181ac4a847bec1e88169327b3295e39f606 /generic
parent6459a50433a6f175cfce01066b1cdb5e1f3e7c8f (diff)
parent09fd21b65b23d0d8ee709bb09cc48d0d4829db90 (diff)
downloadtcl-33918a2b0b4bd10fb1defc2f141b73d20565f40a.zip
tcl-33918a2b0b4bd10fb1defc2f141b73d20565f40a.tar.gz
tcl-33918a2b0b4bd10fb1defc2f141b73d20565f40a.tar.bz2
TIP #587: Default utf-8 for source command
Diffstat (limited to 'generic')
-rw-r--r--generic/tclIOUtil.c36
-rw-r--r--generic/tclZlib.c2
2 files changed, 19 insertions, 19 deletions
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.