diff options
Diffstat (limited to 'generic/tclEncoding.c')
-rw-r--r-- | generic/tclEncoding.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c index 619c2b4..5fd3f20 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.55.2.2 2007/11/12 19:18:16 dgp Exp $ + * RCS: @(#) $Id: tclEncoding.c,v 1.55.2.3 2008/03/13 14:47:29 dgp 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)); } } |