82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
-
+
|
remedy that flaw is to convert from UCS-2 to UTF-16 in the same storage arrays.
[http://tip.tcl.tk/389|TIP 389] points in that direction.
One problem with that answer is that the key reason UCS-2 is used in the first place is
because it is a fixed-width encoding, and that fact allows for more efficient string
processing operations in finding a character at an index, extracting and substituting
substrings, and computing lengths. (It is also used to efficiently and losslessly take in
UTF-16 data from external sources, notably command line data on Windows. On the
UTF-16 data from external sources, notably command line data on Windows.) On the
contrary, UTF-16 is a variable length encoding so the advantage for those operations
is at least diminished, if not lost. If we must manage a variable-length encoding
anyway, we might as well just stick with one encoding for the simplicity that would
imply. To the extent that might happen, many of the routines here would just become
deprecated legacy support routines.
There is no fully specified answer for efficient implementation of the string operations
|