From: SourceForge.net <no...@so...> - 2003-06-11 11:46:30
|
Patches item #752547, was opened at 2003-06-11 04:46 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=312997&aid=752547&group_id=12997 Category: 26. Conversions from String Group: None Status: Open Resolution: None Priority: 5 Submitted By: Nobody/Anonymous (nobody) Assigned to: Jeffrey Hobbs (hobbs) Summary: need allow users input entry fields in non-utf encodings Initial Comment: Hi, I have been developing a software using Tcl/Tk 8.4.3, and had problems with calling to Tk library from inside a C application via Tcl_Eval, when the string to type into entry field was in non-utf8 encoding, it had to be first transported there with appropriate 'Tcl_ExternalToUtfDString' call. The following patch has to be done to tkEntry.c --Alex diff -ruN tk8.4.3/generic/tkEntry.c tk8.4.3c/generic/tkEntry.c --- tk8.4.3/generic/tkEntry.c Tue Feb 25 03:46:41 2003 +++ tk8.4.3c/generic/tkEntry.c Sat Jun 7 13:01:28 2003 @@ -19,6 +19,7 @@ #include "tkInt.h" #include "default.h" +#include <tcl.h> enum EntryType { TK_ENTRY, TK_SPINBOX @@ -1035,7 +1036,28 @@ goto error; } if (entryPtr->state == STATE_NORMAL) { - InsertChars(entryPtr, index, Tcl_GetString(objv[3])); + + +/* InsertChars(entryPtr, index, Tcl_GetString(objv[3])); + */ + /*alexalex*/ + + char * val; + Tcl_DString * dstPtr; + + dstPtr = (Tcl_DString *) ckalloc(sizeof(Tcl_DString)); + + val = Tcl_GetString(objv[3]); + if ((entryPtr->numChars != 1) && strlen(val) == 1) { + + InsertChars(entryPtr, index, + Tcl_ExternalToUtfDString(Tcl_GetEncoding(NULL, Tcl_GetEncodingName(NULL)),val, 1, dstPtr)); + } + else { + InsertChars(entryPtr, index, val); + } + + /*alexalex*/ ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=312997&aid=752547&group_id=12997 |