Skip to content
Tcl Source Code Changes To Migrating scripts to Tcl 9
Login

Changes To Migrating scripts to Tcl 9

Changes to "Migrating scripts to Tcl 9" between 2024-04-14 14:24:06 and 2024-04-15 07:06:17

︙
250
251
252
253
254
255
256












257
258
259
260
261
262
263
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275







+
+
+
+
+
+
+
+
+
+
+
+







The source command may throw encoding errors.

Scripts with non ASCII characters, even in comments, may now fail if the encoding is wrong.
A typical example is a copyright glyph in a non UTF-8 codepage "©" script file.

In TCL8.6, those errors did not arise, as the active tcl8 profile silently changed those characters to inline iso-8859-1 characters.
If it was real code (like text), the script changed in functionality.

## System encoding on Windows may change to UTF-8

The Windows executable Manifest of tclsh.exe and wish.exe were changed to claim UTF-8 character set.
On my Windows 10 system with German locale, the command *encoding system* returns *utf-8* with TCL/Tk 9.0 and *cp1265* with TCL/Tk 8.6.
This is due to the manifest change, not any change within TCL/Tk.

Due to that, the change to UTF-8 encoding of the source command may not be *reverted* by:

```
source -encoding [encoding system] file.tcl
```

## Full Unicode support

In Tcl 8, characters outside the BMP were stored as a surrogate pair
and effectively treated as a string of length 2. This is no longer
the case in Tcl 9 which has full support for the entire Unicode range
and will (correctly) treat these characters as strings of length 1.
︙