Hello. I have the same problem here in Poland. I wrote a quickhack that does the trick in C.
It creates "ns_utf8" Tcl command which I use to convert from external to utf and back. I use this way: Instead of set text [ns_queryget text] I use set text [ns_utf8 eu [ns_queryget text]] Now it is utf-8 encoded (not with the proper encoding though - I should use iso8859-2 :), so Tcl can safely operate on these strings. For example set subtext [string range $text 1 end] Then, when I want to return it to the browser: <%=[ns_utf8 ue $subtext]%> Note that you'd not be able to do this properly for non-latin text without ns_utf8... Also, when AOLserver will finally handle utf-8 correctly, you can just write a dummy proc ns_utf8 {mode text} {return $text} It's a quickhack, but works well. -- WK "Data typing is an illusion. Everything is a sequence of bytes." -Todd Coram
#ifndef USE_TCL8X #define USE_TCL8X #endif #include "ns.h" #include <tcl.h> int Ns_ModuleVersion = 1; static int main_tcl_command (ClientData dummy, Tcl_Interp *interp,int objc, Tcl_Obj *CONST objv[]) { char *cmd; char *v; int l; Tcl_DString ds; Tcl_Obj *rc; Tcl_Encoding te; if (objc!=3) { return TCL_ERROR; } if ((te=Tcl_GetEncoding(interp,NULL))==NULL) { return TCL_ERROR; } Tcl_DStringInit(&ds); cmd=Tcl_GetString(objv[1]); v=Tcl_GetStringFromObj(objv[2],&l); if (!strcmp(cmd,"eu")) { Tcl_ExternalToUtfDString(te,v,l,&ds); } else { Tcl_UtfToExternalDString(te,v,l,&ds); } Tcl_FreeEncoding(te); if ((rc=Tcl_NewStringObj(Tcl_DStringValue(&ds),Tcl_DStringLength(&ds)))!=NULL) { Tcl_SetObjResult(interp, rc); Tcl_DStringFree(&ds); return TCL_OK; } else { Tcl_DStringFree(&ds); return TCL_ERROR; } } int ns_utf8_tcl(Tcl_Interp *i, void *c) { Tcl_CreateObjCommand(i, "ns_utf8", main_tcl_command, NULL, NULL); return TCL_OK; } Ns_ModuleInit(char *hServer, char *hModule) { Ns_TclInitInterps(hServer,ns_utf8_tcl,NULL); return NS_OK; }