Skip to content
Tcl Source Code Changes To Unsupported icu command
Login

Changes To Unsupported icu command

Changes to "Unsupported icu command" between 2024-06-16 11:58:17 and 2024-06-16 12:02:43

︙
19
20
21
22
23
24
25

26

27
28
29
30
31
32

33
34
35
36
37
38
39
19
20
21
22
23
24
25
26

27
28
29
30
31
32

33
34
35
36
37
38
39
40







+
-
+





-
+







In addition, text files containing non-ASCII characters that were written
in `[encoding system]` in Tcl 8 may not be readable in Tcl 9 without an
explicit `fconfigure -encoding` invocation. This is a particular problem
on Windows as `[encoding system]` in Tcl 9 returns `utf-8` irrespective
of the user's code page setting that was used in Tcl 8.

The [tcl9migrate](https://github.com/apnadkarni/tcl9-migrate) tool is
an on-going (as in do not try it yet!) effort to help users with the above
an effort to help users with the above as well as other incompatibilities
as well as other incompatibilities
like octal and tilde expansion. It includes both a static checker based
on Nagelfar as well as a runtime shim to help with the data file encoding
issues. However, it requires some functionality from ICU for this
purpose.

Hence the motivation.
Hence this proposal.

## Specification

The `tcl::unsupported::icu` command ensemble includes subcommands

- `detect` to guess file encodings
- `icuToTcl` and `tclToIcu` to map ICU names to Tcl encoding names and vice versa
︙
55
56
57
58
59
60
61


62
63
64
56
57
58
59
60
61
62
63
64
65
66
67







+
+



differences in libraries loaded stemming from different API's used.
Combining the two is for a later time.

Like Tk, the build system is unaffected as the ICU libraries are
loaded only at runtime. This is intentional though there is a performance
cost associated with searching for the library. This is acceptable
as it will only be incurred on use of the `icu` command.

Code is in branch [apn-experiment-chardet](https://core.tcl-lang.org/tcl/timeline?r=apn-experiment-chardet).