\u001a is an end-of-file character in scripts

As of Tcl Tcl 8.4, the ascii 'substitute' character (\032, \u1a , control-Z) signifies the end of the script on all platforms.

See Also

working with binary data


There are a few reasons Tcl recognizes ascii 'substitute' character as the end of a script. First, it improves script portability between Windows and other systems. Prior to this change, the 'substitute' character signified the end of the script on Windows, but not on other platforms. It was felt that it would be better to make the handling consistent on all platforms.

Second, it is generally useful to be able to store additional data directly after the script. A Starkit, for example, is a script followed by the 'substitute' character followed by a Metakit database. The Tcl interpreter doesn't pay any attention to what is beyond the substitute character, and the script can access the additional data. Other single-file Tcl applications have also put this behavior to good use.

To escape the special meaning of the 'substitute' character, encode it as a \x or \u substitution.