summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tclEncoding.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c
index 930d11d..95f89a4 100644
--- a/generic/tclEncoding.c
+++ b/generic/tclEncoding.c
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclEncoding.c,v 1.58 2007/12/13 15:23:16 dgp Exp $
+ * RCS: @(#) $Id: tclEncoding.c,v 1.59 2008/03/11 22:25:12 das Exp $
*/
#include "tclInt.h"
@@ -1972,6 +1972,7 @@ LoadEscapeEncoding(
final[sizeof(final) - 1] = '\0';
} else {
EscapeSubTable est;
+ Encoding *e;
strncpy(est.sequence, argv[1], sizeof(est.sequence));
est.sequence[sizeof(est.sequence) - 1] = '\0';
@@ -1984,9 +1985,13 @@ LoadEscapeEncoding(
* To avoid infinite recursion in [encoding system iso2022-*]
*/
- Tcl_GetEncoding(NULL, est.name);
-
- est.encodingPtr = NULL;
+ e = (Encoding *) Tcl_GetEncoding(NULL, est.name);
+ if (e && e->toUtfProc != TableToUtfProc &&
+ e->toUtfProc != Iso88591ToUtfProc) {
+ Tcl_FreeEncoding((Tcl_Encoding) e);
+ e = NULL;
+ }
+ est.encodingPtr = e;
Tcl_DStringAppend(&escapeData, (char *) &est, sizeof(est));
}
}