Tcl Source Code

Hex Artifact Content
Login

Artifact 84fde19d5e65bdbd25b2fcabf7f1dc9d8b5f24a6025f1386a577be76a52bc7ce:

Wiki page [Unsupported icu command] by apnadkarni 2024-06-16 12:02:43.
0000: 44 20 32 30 32 34 2d 30 36 2d 31 36 54 31 32 3a  D 2024-06-16T12:
0010: 30 32 3a 34 33 2e 34 39 39 0a 4c 20 55 6e 73 75  02:43.499.L Unsu
0020: 70 70 6f 72 74 65 64 5c 73 69 63 75 5c 73 63 6f  pported\sicu\sco
0030: 6d 6d 61 6e 64 0a 4e 20 74 65 78 74 2f 78 2d 6d  mmand.N text/x-m
0040: 61 72 6b 64 6f 77 6e 0a 50 20 61 61 62 37 39 36  arkdown.P aab796
0050: 39 30 62 37 66 63 32 32 65 38 34 65 61 65 30 34  90b7fc22e84eae04
0060: 33 39 30 38 35 38 37 37 66 63 31 39 36 32 63 64  39085877fc1962cd
0070: 66 64 32 32 66 65 34 39 36 65 34 66 64 36 30 65  fd22fe496e4fd60e
0080: 66 38 33 39 35 35 61 35 65 32 0a 55 20 61 70 6e  f83955a5e2.U apn
0090: 61 64 6b 61 72 6e 69 0a 57 20 32 37 37 31 0a 54  adkarni.W 2771.T
00a0: 68 69 73 20 69 73 20 61 20 70 72 6f 70 6f 73 61  his is a proposa
00b0: 6c 20 74 6f 20 61 64 64 20 61 20 60 74 63 6c 3a  l to add a `tcl:
00c0: 3a 75 6e 73 75 70 70 6f 72 74 65 64 3a 3a 69 63  :unsupported::ic
00d0: 75 60 20 63 6f 6d 6d 61 6e 64 20 74 6f 20 54 63  u` command to Tc
00e0: 6c 20 39 2e 0d 0a 54 68 65 20 70 72 69 6d 61 72  l 9...The primar
00f0: 79 20 67 6f 61 6c 20 69 73 20 74 6f 20 68 65 6c  y goal is to hel
0100: 70 20 77 69 74 68 20 6d 69 67 72 61 74 69 6f 6e  p with migration
0110: 20 6f 66 20 54 63 6c 20 38 20 73 63 72 69 70 74   of Tcl 8 script
0120: 73 20 74 6f 20 54 63 6c 20 39 2e 0d 0a 41 20 28  s to Tcl 9...A (
0130: 6d 75 63 68 29 20 6c 65 73 73 65 72 20 62 65 6e  much) lesser ben
0140: 65 66 69 74 20 69 73 20 74 6f 20 62 65 20 61 62  efit is to be ab
0150: 6c 65 20 74 6f 20 65 78 70 65 72 69 6d 65 6e 74  le to experiment
0160: 20 77 69 74 68 20 49 43 55 20 66 75 6e 63 74 69   with ICU functi
0170: 6f 6e 73 0d 0a 66 6f 72 20 68 61 6e 64 6c 69 6e  ons..for handlin
0180: 67 20 73 74 72 69 6e 67 73 20 61 6e 64 20 65 6e  g strings and en
0190: 63 6f 64 69 6e 67 73 2e 0d 0a 0d 0a 23 23 20 4d  codings.....## M
01a0: 6f 74 69 76 61 74 69 6f 6e 0d 0a 0d 0a 54 68 65  otivation....The
01b0: 72 65 20 61 72 65 20 74 77 6f 20 63 68 61 6e 67  re are two chang
01c0: 65 73 20 69 6e 20 54 63 6c 20 39 20 74 68 61 74  es in Tcl 9 that
01d0: 20 74 6f 67 65 74 68 65 72 20 63 61 6e 20 70 72   together can pr
01e0: 65 76 65 6e 74 20 65 76 65 6e 20 73 6f 75 72 63  event even sourc
01f0: 69 6e 67 0d 0a 54 63 6c 20 38 20 73 63 72 69 70  ing..Tcl 8 scrip
0200: 74 73 2e 0d 0a 0d 0a 2d 20 43 68 61 6e 67 65 20  ts.....- Change 
0210: 69 6e 20 74 68 65 20 60 73 6f 75 72 63 65 60 20  in the `source` 
0220: 65 6e 63 6f 64 69 6e 67 20 63 6f 6d 6d 61 6e 64  encoding command
0230: 20 74 6f 20 75 73 65 20 55 54 46 2d 38 20 62 79   to use UTF-8 by
0240: 20 64 65 66 61 75 6c 74 2e 0d 0a 0d 0a 2d 20 54   default.....- T
0250: 68 65 20 69 6e 74 72 6f 64 75 63 74 69 6f 6e 20  he introduction 
0260: 6f 66 20 74 68 65 20 60 73 74 72 69 63 74 60 20  of the `strict` 
0270: 65 6e 63 6f 64 69 6e 67 20 70 72 6f 66 69 6c 65  encoding profile
0280: 20 66 6f 72 20 28 6d 6f 73 74 29 20 49 2f 4f 2e   for (most) I/O.
0290: 0d 0a 0d 0a 54 68 65 20 74 77 6f 20 63 68 61 6e  ....The two chan
02a0: 67 65 73 20 61 62 6f 76 65 20 6d 65 61 6e 20 74  ges above mean t
02b0: 68 61 74 20 65 76 65 6e 20 61 20 73 69 6e 67 6c  hat even a singl
02c0: 65 20 63 6f 70 79 72 69 67 68 74 20 28 55 2b 30  e copyright (U+0
02d0: 30 41 39 29 20 63 68 61 72 61 63 74 65 72 0d 0a  0A9) character..
02e0: 69 6e 20 61 6e 20 6f 74 68 65 72 77 69 73 65 20  in an otherwise 
02f0: 41 53 43 49 49 20 66 69 6c 65 20 77 69 6c 6c 20  ASCII file will 
0300: 70 72 65 76 65 6e 74 20 74 68 65 20 73 63 72 69  prevent the scri
0310: 70 74 20 66 72 6f 6d 20 62 65 69 6e 67 20 6c 6f  pt from being lo
0320: 61 64 65 64 20 69 66 0d 0a 74 68 65 20 66 69 6c  aded if..the fil
0330: 65 20 69 73 20 69 6e 20 49 53 4f 38 38 35 39 2d  e is in ISO8859-
0340: 31 20 65 6e 63 6f 64 69 6e 67 20 61 73 20 69 73  1 encoding as is
0350: 20 63 6f 6d 6d 6f 6e 2e 0d 0a 0d 0a 49 6e 20 61   common.....In a
0360: 64 64 69 74 69 6f 6e 2c 20 74 65 78 74 20 66 69  ddition, text fi
0370: 6c 65 73 20 63 6f 6e 74 61 69 6e 69 6e 67 20 6e  les containing n
0380: 6f 6e 2d 41 53 43 49 49 20 63 68 61 72 61 63 74  on-ASCII charact
0390: 65 72 73 20 74 68 61 74 20 77 65 72 65 20 77 72  ers that were wr
03a0: 69 74 74 65 6e 0d 0a 69 6e 20 60 5b 65 6e 63 6f  itten..in `[enco
03b0: 64 69 6e 67 20 73 79 73 74 65 6d 5d 60 20 69 6e  ding system]` in
03c0: 20 54 63 6c 20 38 20 6d 61 79 20 6e 6f 74 20 62   Tcl 8 may not b
03d0: 65 20 72 65 61 64 61 62 6c 65 20 69 6e 20 54 63  e readable in Tc
03e0: 6c 20 39 20 77 69 74 68 6f 75 74 20 61 6e 0d 0a  l 9 without an..
03f0: 65 78 70 6c 69 63 69 74 20 60 66 63 6f 6e 66 69  explicit `fconfi
0400: 67 75 72 65 20 2d 65 6e 63 6f 64 69 6e 67 60 20  gure -encoding` 
0410: 69 6e 76 6f 63 61 74 69 6f 6e 2e 20 54 68 69 73  invocation. This
0420: 20 69 73 20 61 20 70 61 72 74 69 63 75 6c 61 72   is a particular
0430: 20 70 72 6f 62 6c 65 6d 0d 0a 6f 6e 20 57 69 6e   problem..on Win
0440: 64 6f 77 73 20 61 73 20 60 5b 65 6e 63 6f 64 69  dows as `[encodi
0450: 6e 67 20 73 79 73 74 65 6d 5d 60 20 69 6e 20 54  ng system]` in T
0460: 63 6c 20 39 20 72 65 74 75 72 6e 73 20 60 75 74  cl 9 returns `ut
0470: 66 2d 38 60 20 69 72 72 65 73 70 65 63 74 69 76  f-8` irrespectiv
0480: 65 0d 0a 6f 66 20 74 68 65 20 75 73 65 72 27 73  e..of the user's
0490: 20 63 6f 64 65 20 70 61 67 65 20 73 65 74 74 69   code page setti
04a0: 6e 67 20 74 68 61 74 20 77 61 73 20 75 73 65 64  ng that was used
04b0: 20 69 6e 20 54 63 6c 20 38 2e 0d 0a 0d 0a 54 68   in Tcl 8.....Th
04c0: 65 20 5b 74 63 6c 39 6d 69 67 72 61 74 65 5d 28  e [tcl9migrate](
04d0: 68 74 74 70 73 3a 2f 2f 67 69 74 68 75 62 2e 63  https://github.c
04e0: 6f 6d 2f 61 70 6e 61 64 6b 61 72 6e 69 2f 74 63  om/apnadkarni/tc
04f0: 6c 39 2d 6d 69 67 72 61 74 65 29 20 74 6f 6f 6c  l9-migrate) tool
0500: 20 69 73 0d 0a 61 6e 20 6f 6e 2d 67 6f 69 6e 67   is..an on-going
0510: 20 28 61 73 20 69 6e 20 64 6f 20 6e 6f 74 20 74   (as in do not t
0520: 72 79 20 69 74 20 79 65 74 21 29 20 65 66 66 6f  ry it yet!) effo
0530: 72 74 20 74 6f 20 68 65 6c 70 20 75 73 65 72 73  rt to help users
0540: 20 77 69 74 68 20 74 68 65 20 61 62 6f 76 65 0d   with the above.
0550: 0a 61 73 20 77 65 6c 6c 20 61 73 20 6f 74 68 65  .as well as othe
0560: 72 20 69 6e 63 6f 6d 70 61 74 69 62 69 6c 69 74  r incompatibilit
0570: 69 65 73 0d 0a 6c 69 6b 65 20 6f 63 74 61 6c 20  ies..like octal 
0580: 61 6e 64 20 74 69 6c 64 65 20 65 78 70 61 6e 73  and tilde expans
0590: 69 6f 6e 2e 20 49 74 20 69 6e 63 6c 75 64 65 73  ion. It includes
05a0: 20 62 6f 74 68 20 61 20 73 74 61 74 69 63 20 63   both a static c
05b0: 68 65 63 6b 65 72 20 62 61 73 65 64 0d 0a 6f 6e  hecker based..on
05c0: 20 4e 61 67 65 6c 66 61 72 20 61 73 20 77 65 6c   Nagelfar as wel
05d0: 6c 20 61 73 20 61 20 72 75 6e 74 69 6d 65 20 73  l as a runtime s
05e0: 68 69 6d 20 74 6f 20 68 65 6c 70 20 77 69 74 68  him to help with
05f0: 20 74 68 65 20 64 61 74 61 20 66 69 6c 65 20 65   the data file e
0600: 6e 63 6f 64 69 6e 67 0d 0a 69 73 73 75 65 73 2e  ncoding..issues.
0610: 20 48 6f 77 65 76 65 72 2c 20 69 74 20 72 65 71   However, it req
0620: 75 69 72 65 73 20 73 6f 6d 65 20 66 75 6e 63 74  uires some funct
0630: 69 6f 6e 61 6c 69 74 79 20 66 72 6f 6d 20 49 43  ionality from IC
0640: 55 20 66 6f 72 20 74 68 69 73 0d 0a 70 75 72 70  U for this..purp
0650: 6f 73 65 2e 0d 0a 0d 0a 48 65 6e 63 65 20 74 68  ose.....Hence th
0660: 69 73 20 70 72 6f 70 6f 73 61 6c 2e 0d 0a 0d 0a  is proposal.....
0670: 23 23 20 53 70 65 63 69 66 69 63 61 74 69 6f 6e  ## Specification
0680: 0d 0a 0d 0a 54 68 65 20 60 74 63 6c 3a 3a 75 6e  ....The `tcl::un
0690: 73 75 70 70 6f 72 74 65 64 3a 3a 69 63 75 60 20  supported::icu` 
06a0: 63 6f 6d 6d 61 6e 64 20 65 6e 73 65 6d 62 6c 65  command ensemble
06b0: 20 69 6e 63 6c 75 64 65 73 20 73 75 62 63 6f 6d   includes subcom
06c0: 6d 61 6e 64 73 0d 0a 0d 0a 2d 20 60 64 65 74 65  mands....- `dete
06d0: 63 74 60 20 74 6f 20 67 75 65 73 73 20 66 69 6c  ct` to guess fil
06e0: 65 20 65 6e 63 6f 64 69 6e 67 73 0d 0a 2d 20 60  e encodings..- `
06f0: 69 63 75 54 6f 54 63 6c 60 20 61 6e 64 20 60 74  icuToTcl` and `t
0700: 63 6c 54 6f 49 63 75 60 20 74 6f 20 6d 61 70 20  clToIcu` to map 
0710: 49 43 55 20 6e 61 6d 65 73 20 74 6f 20 54 63 6c  ICU names to Tcl
0720: 20 65 6e 63 6f 64 69 6e 67 20 6e 61 6d 65 73 20   encoding names 
0730: 61 6e 64 20 76 69 63 65 20 76 65 72 73 61 0d 0a  and vice versa..
0740: 0d 0a 54 68 65 73 65 20 77 72 61 70 20 74 68 65  ..These wrap the
0750: 20 6c 6f 77 65 72 20 6c 65 76 65 6c 20 49 43 55   lower level ICU
0760: 20 41 50 49 20 77 68 69 63 68 20 69 73 20 69 6e   API which is in
0770: 74 65 72 6e 61 6c 20 75 73 65 20 6f 6e 6c 79 20  ternal use only 
0780: 61 74 20 74 68 65 20 6d 6f 6d 65 6e 74 20 61 6e  at the moment an
0790: 64 20 6e 6f 74 0d 0a 64 6f 63 75 6d 65 6e 74 65  d not..documente
07a0: 64 20 68 65 72 65 2e 0d 0a 0d 0a 54 68 65 20 63  d here.....The c
07b0: 6f 6d 6d 61 6e 64 20 77 69 6c 6c 20 62 65 20 61  ommand will be a
07c0: 75 74 6f 2d 6c 6f 61 64 65 64 20 6f 6e 20 66 69  uto-loaded on fi
07d0: 72 73 74 20 75 73 65 2e 0d 0a 0d 0a 54 68 65 20  rst use.....The 
07e0: 49 43 55 20 6c 69 62 72 61 72 69 65 73 20 77 69  ICU libraries wi
07f0: 6c 6c 20 6e 6f 74 20 62 65 20 73 68 69 70 70 65  ll not be shippe
0800: 64 20 77 69 74 68 20 54 63 6c 20 61 6e 64 20 74  d with Tcl and t
0810: 68 65 20 66 75 6e 63 74 69 6f 6e 61 6c 69 74 79  he functionality
0820: 0d 0a 77 69 6c 6c 20 6e 6f 74 20 62 65 20 61 76  ..will not be av
0830: 61 69 6c 61 62 6c 65 20 6f 6e 20 73 79 73 74 65  ailable on syste
0840: 6d 73 20 74 68 61 74 20 64 6f 20 6e 6f 74 20 68  ms that do not h
0850: 61 76 65 20 74 68 65 6d 20 69 6e 73 74 61 6c 6c  ave them install
0860: 65 64 2e 0d 0a 54 68 69 73 20 69 73 20 61 63 63  ed...This is acc
0870: 65 70 74 61 62 6c 65 20 62 65 63 61 75 73 65 20  eptable because 
0880: 74 68 65 20 69 6e 74 65 6e 64 65 64 20 75 73 65  the intended use
0890: 20 69 73 20 6f 6e 20 64 65 76 65 6c 6f 70 65 72   is on developer
08a0: 20 73 79 73 74 65 6d 73 0d 0a 75 73 65 64 20 66   systems..used f
08b0: 6f 72 20 70 6f 72 74 69 6e 67 20 73 63 72 69 70  or porting scrip
08c0: 74 73 2e 20 4f 6e 20 72 65 63 65 6e 74 20 76 65  ts. On recent ve
08d0: 72 73 69 6f 6e 73 20 6f 66 20 57 69 6e 64 6f 77  rsions of Window
08e0: 73 20 31 30 20 61 6e 64 20 6c 61 74 65 72 2c 0d  s 10 and later,.
08f0: 0a 49 43 55 20 69 73 20 61 6c 72 65 61 64 79 20  .ICU is already 
0900: 70 72 65 73 65 6e 74 20 61 73 20 70 61 72 74 20  present as part 
0910: 6f 66 20 74 68 65 20 73 79 73 74 65 6d 20 6c 69  of the system li
0920: 62 72 61 72 69 65 73 2e 0d 0a 0d 0a 23 23 20 49  braries.....## I
0930: 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 0d 0a 0d  mplementation...
0940: 0a 49 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20  .Implementation 
0950: 66 6f 6c 6c 6f 77 73 20 74 68 65 20 6f 6e 65 20  follows the one 
0960: 61 6c 72 65 61 64 79 20 70 72 65 73 65 6e 74 20  already present 
0970: 69 6e 20 54 6b 20 65 78 63 65 70 74 20 66 6f 72  in Tk except for
0980: 0d 0a 64 69 66 66 65 72 65 6e 63 65 73 20 69 6e  ..differences in
0990: 20 6c 69 62 72 61 72 69 65 73 20 6c 6f 61 64 65   libraries loade
09a0: 64 20 73 74 65 6d 6d 69 6e 67 20 66 72 6f 6d 20  d stemming from 
09b0: 64 69 66 66 65 72 65 6e 74 20 41 50 49 27 73 20  different API's 
09c0: 75 73 65 64 2e 0d 0a 43 6f 6d 62 69 6e 69 6e 67  used...Combining
09d0: 20 74 68 65 20 74 77 6f 20 69 73 20 66 6f 72 20   the two is for 
09e0: 61 20 6c 61 74 65 72 20 74 69 6d 65 2e 0d 0a 0d  a later time....
09f0: 0a 4c 69 6b 65 20 54 6b 2c 20 74 68 65 20 62 75  .Like Tk, the bu
0a00: 69 6c 64 20 73 79 73 74 65 6d 20 69 73 20 75 6e  ild system is un
0a10: 61 66 66 65 63 74 65 64 20 61 73 20 74 68 65 20  affected as the 
0a20: 49 43 55 20 6c 69 62 72 61 72 69 65 73 20 61 72  ICU libraries ar
0a30: 65 0d 0a 6c 6f 61 64 65 64 20 6f 6e 6c 79 20 61  e..loaded only a
0a40: 74 20 72 75 6e 74 69 6d 65 2e 20 54 68 69 73 20  t runtime. This 
0a50: 69 73 20 69 6e 74 65 6e 74 69 6f 6e 61 6c 20 74  is intentional t
0a60: 68 6f 75 67 68 20 74 68 65 72 65 20 69 73 20 61  hough there is a
0a70: 20 70 65 72 66 6f 72 6d 61 6e 63 65 0d 0a 63 6f   performance..co
0a80: 73 74 20 61 73 73 6f 63 69 61 74 65 64 20 77 69  st associated wi
0a90: 74 68 20 73 65 61 72 63 68 69 6e 67 20 66 6f 72  th searching for
0aa0: 20 74 68 65 20 6c 69 62 72 61 72 79 2e 20 54 68   the library. Th
0ab0: 69 73 20 69 73 20 61 63 63 65 70 74 61 62 6c 65  is is acceptable
0ac0: 0d 0a 61 73 20 69 74 20 77 69 6c 6c 20 6f 6e 6c  ..as it will onl
0ad0: 79 20 62 65 20 69 6e 63 75 72 72 65 64 20 6f 6e  y be incurred on
0ae0: 20 75 73 65 20 6f 66 20 74 68 65 20 60 69 63 75   use of the `icu
0af0: 60 20 63 6f 6d 6d 61 6e 64 2e 0d 0a 0d 0a 43 6f  ` command.....Co
0b00: 64 65 20 69 73 20 69 6e 20 62 72 61 6e 63 68 20  de is in branch 
0b10: 5b 61 70 6e 2d 65 78 70 65 72 69 6d 65 6e 74 2d  [apn-experiment-
0b20: 63 68 61 72 64 65 74 5d 28 68 74 74 70 73 3a 2f  chardet](https:/
0b30: 2f 63 6f 72 65 2e 74 63 6c 2d 6c 61 6e 67 2e 6f  /core.tcl-lang.o
0b40: 72 67 2f 74 63 6c 2f 74 69 6d 65 6c 69 6e 65 3f  rg/tcl/timeline?
0b50: 72 3d 61 70 6e 2d 65 78 70 65 72 69 6d 65 6e 74  r=apn-experiment
0b60: 2d 63 68 61 72 64 65 74 29 2e 0d 0a 0d 0a 0d 0a  -chardet).......
0b70: 0d 0a 0a 5a 20 63 65 61 62 30 39 37 38 33 39 64  ...Z ceab097839d
0b80: 63 30 66 38 31 33 39 63 30 63 63 39 30 63 62 33  c0f8139c0cc90cb3
0b90: 32 32 32 61 62 0a                                222ab.