Skip to content
Tcl Source Code Changes To Encoding Loading
Login

Changes To Encoding Loading

Changes to "Encoding Loading" between 2014-09-12 18:33:14 and 2014-09-12 18:34:31

︙
38
39
40
41
42
43
44
45

46
47
48
49
50
51
52
38
39
40
41
42
43
44

45
46
47
48
49
50
51
52







-
+







we make sure that handling of the <b>utf-8</b> encoding is built-in to Tcl, with
no need to bring data in from a file first.  That's the foundation of the bootstrap.
Then we define that all <i>*.enc</i> files must be stored in the <b>utf-8</b>
encoding.  This relieves all concern about the channel read operation.

We still have to query the filesystem.  Here is where Tcl's virtual filesystem architecture
holds the key.  Each Tcl_Filesystem can define a <b>Tcl_FSCreateInternalRepProc</b>
to generate the data format it needs and can cache to interact with whatever backing system
to generate the data format it needs (and may cache) to interact with whatever backing system
it is using to implement the filesystem.  In the current implementation, the unix native
filesystem uses the routine <b>TclNativeCreateNativeRep</b> to perform this function,
and it in turn calls <b>Tcl_UtfToExternalDString</b> to apply the system encoding to
get something suitable for passing to <b>TclOSOpen</b>.  That closes the cycle.
(Note that Windows doesn't put in place any cycle.  Maybe once it did, but no more.)

So long as Tcl believes the system encoding is <b>utf-8</b> there's no problem, and
︙