summaryrefslogtreecommitdiffstats
path: root/generic/tclCmdAH.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclCmdAH.c')
-rw-r--r--generic/tclCmdAH.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/generic/tclCmdAH.c b/generic/tclCmdAH.c
index 8a76602..1ef0dcf 100644
--- a/generic/tclCmdAH.c
+++ b/generic/tclCmdAH.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclCmdAH.c,v 1.58 2005/01/21 17:42:12 andreas_kupries Exp $
+ * RCS: @(#) $Id: tclCmdAH.c,v 1.59 2005/04/08 20:04:03 dgp Exp $
*/
#include "tclInt.h"
@@ -455,24 +455,21 @@ Tcl_EncodingObjCmd(dummy, interp, objc, objv)
switch ((enum options) index) {
case ENC_CONVERTTO:
case ENC_CONVERTFROM: {
- char *name;
Tcl_Obj *data;
if (objc == 3) {
- name = NULL;
+ encoding = Tcl_GetEncoding(interp, NULL);
data = objv[2];
} else if (objc == 4) {
- name = TclGetString(objv[2]);
+ if (TclGetEncodingFromObj(interp, objv[2], &encoding)
+ != TCL_OK) {
+ return TCL_ERROR;
+ }
data = objv[3];
} else {
Tcl_WrongNumArgs(interp, 2, objv, "?encoding? data");
return TCL_ERROR;
}
- encoding = Tcl_GetEncoding(interp, name);
- if (!encoding) {
- return TCL_ERROR;
- }
-
if ((enum options) index == ENC_CONVERTFROM) {
/*
* Treat the string as binary data.