summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorandreas_kupries <akupries@shaw.ca>2007-11-05 19:58:48 (GMT)
committerandreas_kupries <akupries@shaw.ca>2007-11-05 19:58:48 (GMT)
commit9255f17568bef90c687723cf1374fe7132d53e8b (patch)
treeca15b3374494e46f7dad1dac0b05227e622c64dd
parent791ccfdcdbc2bee84c4100c5a2c66e600ff247c2 (diff)
downloadtcl-9255f17568bef90c687723cf1374fe7132d53e8b.zip
tcl-9255f17568bef90c687723cf1374fe7132d53e8b.tar.gz
tcl-9255f17568bef90c687723cf1374fe7132d53e8b.tar.bz2
* generic/tclConfig.c (Tcl_RegisterConfig): Modified to use
iso8859-1 as a fallback if the user supplied encoding was not found. That way we do not crash. It is unclear however if this is a sane fallback given that the encoding is likely wrong and producing bogus strings. See [SF Tcl Bug 983509] for more discussion.
-rw-r--r--ChangeLog9
-rw-r--r--generic/tclConfig.c7
2 files changed, 15 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 0cfe581..79ef752 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2007-11-05 Andreas Kupries <andreask@activestate.com>
+
+ * generic/tclConfig.c (Tcl_RegisterConfig): Modified to use
+ iso8859-1 as a fallback if the user supplied encoding was not
+ found. That way we do not crash. It is unclear however if this
+ is a sane fallback given that the encoding is likely wrong and
+ producing bogus strings. See [SF Tcl Bug 983509] for more
+ discussion.
+
2007-11-05 Andreas Kupries <andreask@activestate.com>
* unix/tclUnixChan.c (TtyGetOptionProc): Accepted [SF Tcl Patch
diff --git a/generic/tclConfig.c b/generic/tclConfig.c
index 1199e81..e7d9bf3 100644
--- a/generic/tclConfig.c
+++ b/generic/tclConfig.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclConfig.c,v 1.14 2007/04/10 14:47:10 dkf Exp $
+ * RCS: @(#) $Id: tclConfig.c,v 1.15 2007/11/05 19:58:48 andreas_kupries Exp $
*/
#include "tclInt.h"
@@ -71,6 +71,11 @@ Tcl_RegisterConfig(
Tcl_Config *cfg;
Tcl_Encoding venc = Tcl_GetEncoding(NULL, valEncoding);
+ if (venc == NULL) {
+ /* Fall back to a builtin encoding if the user supplied one is bogus. */
+ venc = Tcl_GetEncoding(NULL, "iso8859-1");
+ }
+
pDB = GetConfigDict(interp);
pkg = Tcl_NewStringObj(pkgName, -1);