On certain installations of Tcl/Tk 8.3.1, the passing
character-triplets ending in octal 240 (decimal 160,
interferes with list delimitation when
Tcl_AppendElement is used
to return a result from a C function. In particular,
if a UTF-8
string ending in octal 240 is appended to the result,
another UTF-8 string is appended afterwards, the octal
to be interpreted as a "forward delete" character of
with the result that the separation between the two
is erased and they are interpreted as one.
The following C function, when called from Tcl,
int sendCharList(ClientData clientData, Tcl_Interp *interp,
int argc, char **argv)
char s1, s2, s3, s4;
The Tcl calls:
set s6 [sendCharList]
puts "[llength $s6] , [string length $s6]"
should output "4 , 7" (4 list elements, each a single UTF-8
composite character plus 3 delimiters). On some
systems it does.
On others, however, the output is "1 , 4", resulting from
deletion of the list delimiters somewhere during
passage from C
to Tcl. A complete test program involving the above
additional tests and using wish not tclsh) may be
A full application that exposes the bug (and led to its
discovery) may be found at:
Unfortunately, I have not been able to isolate why some
installations exhibit the bug and some don't. A
default SUSE 7.0
Linux installation of 8.3.1 had the problem, while a
Slackware 7.1 installation of the same Tcl/Tk version
Maybe it is a compilation flag difference... ?
I'm also not sure whether it persists in 8.3.2 or 8.4.