Skip to content
Tcl Source Code Changes To Encoding Loading
Login

Changes To Encoding Loading

Changes to "Encoding Loading" between 2014-09-12 18:34:31 and 2014-09-12 18:35:44

︙
43
44
45
46
47
48
49
50


51
52
53
54
55
56
57
43
44
45
46
47
48
49

50
51
52
53
54
55
56
57
58







-
+
+







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 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.)
(Note that Windows doesn't put in place any similar cycle.  It makes no call back into
the [Encoding System].  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
that's a common environment on unix systems.  But we are vulnerable to trouble with
other values for the system encoding.  The solution requires breaking out of this mistaken
concept of a system encoding.  There's no such thing.  At this point, we do not care what
encoding <i>the system</i> uses, whatever that means.  We specifically want to know
how to convert Tcl path values into values this native filesystem can understand.  That's
︙