Tcl_ExternalToUtf appends a terminating NUL to its encoded results.
Perhaps this is a welcome convenience for some callers, but not for Tcl's
I/O system, which has no need for that.  Added a new flag value
TCL_ENCODING_NO_TERMINATE that callers can use to suppress this behavior.
This means buffers don't require so much padding, and a tiny bit of processing
is saved.  Update I/O callers to use the feature.
With no padding needed for a terminating NUL, there no need for a distinction
between the dstNeeded and dstLimit values.
Add to Tcl_ExternalToUtf() a capability to impose a limit on the number
of chars produce in the encoding result.  When the flag
TCL_ENCODING_CHAR_LIMIT is set and dstCharsPtr is not NULL, then the
initial value of *dstCharsPtr is taken as the max number of chars to produce.
The limit is imposed in a way that does not require the assistance of the
encoding's driver procs, but the flag is passed on to them in case they
can do better when they know they should.  No callers updated yet.
No drivers updated yet.

One difficulty is that this necessarily imposes a pre-translation limit,
and the I/O system has a history of wanting to impose only a post-translation
limit.
merge trunk
merge trunk
[e711ffb458] Replace TclIsLocalScalar() (which does the wrong thing).... with
PushVarNameWord() (which doesn't) in the compiler for [dict lappend].
[e711ffb458] Replace TclIsLocalScalar() with PushVarNameWord() in the
compiler for [dict set].
[e711ffb458] Same conversion for [catch] compiler.
Get the word number right, even though it has no effect.
Similar revisions to [dict incr] compiler.
Similar conversion for [dict update] compiler.
Similar conversion of the [dict append] compiler.
changes for TIP427
Revise encoding finalization so that it does a more complete job of restoring
the pre-initialized state.  This makes finalization errors more repeatable
and cross-platform.
Rework the *FinalizeThread*() routines so that the quick exit preference
is respected without need to run afoul of encoding finalizations.
tests pass now.  All changes are fully internal.
[af08e89777] Rework finalization to stop encoding-24.2 segfault.
[7c187a3773] Fix error in managing inStatePtr->inQueueTail value in the
byte-moving optimized path of [chan copy].  Thanks to Benno.
merge 8.5
Shift the allocation of AuxData earlier in the [foreach] compiler.
With that shift, varcList is no longer needed.