Skip to content
Tcl Source Code Check-in [7cefe002e7]
Login

Check-in [7cefe002e7]

Overview
Comment:Add two new (undocumented) flags to the Tcl_ExternalToUtf() interface. TCL_ENCODING_NO_TERMINATE rejects the default behavior of appending a terminating NUL byte to the produced Utf output. This permits use of all of the dstLen bytes provided, and simplifies the buffer size calculations demanded from callers. Perhaps some callers need or appreciate this default behavior, but for Tcl's own main use of encodings - conversions within I/O - this just gets in the way. TCL_ENCODING_CHAR_LIMIT lets the caller set a limit on the number of chars to be output to be enforced by the encoding routines themselves. Without this, callers have to check after the fact for going beyond limits and make multiple encoding calls in a trial and error approach. Full compatibility is supported. No defaults are changed, and the flags have their effect even if an encoding driver has not been written to support these flags (but greater efficiency is enjoyed if they do!). All of Tcl's own encoding drivers are updated to support this. Other encoding drivers may exist somewhere, but I cannot point to any. A TIP to document this and make it officially supported may come in time.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 7cefe002e742bc53de10591f3c3b5d363889ecf4
User & Date: dgp on 2014-12-23 18:39:35.633
Other Links: manifest | tags
References
2026-10-14
18:46 • Closed ticket [494ed61db1]: env() array not reflecting actual env plus 4 oth... artifact: aef1d79088 user: serhiy.storchaka
Context
2015-01-02
22:42
Now that we're using TCL_ENCODING_NO_TERMINATE - be careful about acting on the contents of dst -- t... check-in: bd7e81c0fb user: dgp tags: trunk
2014-12-23
18:44
merge trunk check-in: 526ce54517 user: dgp tags: novem
18:39
Add two new (undocumented) flags to the Tcl_ExternalToUtf() interface. TCL_ENCODING_NO_TERMINATE rej... check-in: 7cefe002e7 user: dgp tags: trunk
17:53
Support TCL_ENCODING_CHAR_LIMIT in TableToUtfProc and EscapeToUtfProc drivers. closed check-in: 14b0ab81bb user: dgp tags: dgp-encoding-flags
02:41
Use more suitable variable name pushers. check-in: d9a4be6a30 user: dgp tags: trunk
Changes