Tcl Source Code

Hex Artifact Content
Login

Artifact 5f98e7112d002bbf95324a3cbab5ab54c5134893:

Attachment "[email protected]" to ticket [1972867fff] added by msofer 2008-05-26 20:09:41.
0000: 6b 62 6b 09 49 20 64 6f 6e 27 74 20 6b 6e 6f 77  kbk.I don't know
0010: 20 69 66 20 69 74 27 73 20 62 79 74 65 63 6f 6d   if it's bytecom
0020: 70 69 6c 61 74 69 6f 6e 2e 2e 2e 20 68 61 76 65  pilation... have
0030: 20 79 6f 75 20 74 72 69 65 64 20 64 6f 69 6e 67   you tried doing
0040: 20 74 68 65 20 62 63 63 27 65 64 20 6f 6e 65 20   the bcc'ed one 
0050: 66 69 72 73 74 3f 0a 6d 69 67 75 65 6c 09 61 68  first?.miguel.ah
0060: 68 20 2e 2e 2e 20 69 66 20 49 20 64 6f 20 74 68  h ... if I do th
0070: 65 20 62 63 63 27 65 64 20 66 69 72 73 74 2c 20  e bcc'ed first, 
0080: 62 6f 74 68 20 62 65 68 61 76 65 20 74 68 65 20  both behave the 
0090: 73 61 6d 65 20 2d 20 61 73 20 74 68 65 20 62 63  same - as the bc
00a0: 63 27 65 64 20 75 73 65 64 20 74 6f 20 64 6f 20  c'ed used to do 
00b0: 28 69 65 2c 20 74 68 65 20 77 72 6f 6e 67 20 6f  (ie, the wrong o
00c0: 6e 65 20 61 63 63 6f 72 64 69 6e 67 20 74 6f 20  ne according to 
00d0: 74 68 65 20 74 65 73 74 73 75 69 74 65 29 0a 6b  the testsuite).k
00e0: 62 6b 09 49 20 74 68 69 6e 6b 20 69 74 20 68 61  bk.I think it ha
00f0: 73 20 74 6f 20 64 6f 20 70 6f 73 73 69 62 6c 79  s to do possibly
0100: 20 77 69 74 68 20 6c 6f 73 69 6e 67 20 74 68 65   with losing the
0110: 20 73 74 61 74 65 20 6f 66 20 74 68 65 20 73 68   state of the sh
0120: 69 66 74 6a 69 73 20 64 65 63 6f 64 65 72 2e 0a  iftjis decoder..
0130: 6b 62 6b 09 41 6e 79 20 69 64 65 61 20 77 68 61  kbk.Any idea wha
0140: 74 20 74 68 65 20 27 6f 6c 64 20 6f 6e 65 20 66  t the 'old one f
0150: 6f 75 6e 64 27 20 63 6f 6d 6d 65 6e 74 20 69 73  ound' comment is
0160: 20 61 6c 6c 20 61 62 6f 75 74 3f 0a 6d 69 67 75   all about?.migu
0170: 65 6c 09 6e 6f 70 65 0a 6b 62 6b 09 41 6e 64 20  el.nope.kbk.And 
0180: 77 68 61 74 27 73 20 77 69 74 68 20 5b 65 6e 63  what's with [enc
0190: 6f 64 69 6e 67 20 73 79 73 74 65 6d 20 69 64 65  oding system ide
01a0: 6e 74 69 74 79 5d 20 74 77 69 63 65 20 28 6c 69  ntity] twice (li
01b0: 6e 65 73 20 31 30 20 61 6e 64 20 32 33 29 3f 20  nes 10 and 23)? 
01c0: 20 53 65 65 6d 73 20 61 73 20 69 66 20 74 68 61   Seems as if tha
01d0: 74 20 6f 75 67 68 74 20 74 6f 20 64 6f 20 70 72  t ought to do pr
01e0: 65 63 69 73 65 6c 79 20 6e 6f 74 68 69 6e 67 2c  ecisely nothing,
01f0: 20 73 69 6e 63 65 20 73 79 73 74 65 6d 20 65 6e   since system en
0200: 63 6f 64 69 6e 67 20 69 73 20 61 6c 72 65 61 64  coding is alread
0210: 79 20 27 69 64 65 6e 74 69 74 79 27 0a 6b 62 6b  y 'identity'.kbk
0220: 09 48 6d 6d 6d 2c 20 69 73 20 74 68 69 73 20 57  .Hmmm, is this W
0230: 69 6e 64 6f 77 73 3f 0a 6b 62 6b 09 6e 6f 2c 20  indows?.kbk.no, 
0240: 6e 65 76 65 72 20 6d 69 6e 64 2c 20 49 20 73 65  never mind, I se
0250: 65 20 69 74 27 73 20 75 6e 69 78 0a 6b 62 6b 09  e it's unix.kbk.
0260: 54 68 65 20 69 73 73 75 65 20 69 73 20 6c 69 74  The issue is lit
0270: 65 72 61 6c 20 6c 69 66 65 74 69 6d 65 20 61 6e  eral lifetime an
0280: 64 20 77 68 65 74 68 65 72 20 74 68 65 20 73 68  d whether the sh
0290: 69 66 74 6a 69 73 20 65 6e 63 6f 64 69 6e 67 20  iftjis encoding 
02a0: 63 61 6e 20 62 65 20 66 6f 75 6e 64 20 77 68 65  can be found whe
02b0: 6e 20 5b 20 65 6e 63 6f 64 69 6e 67 20 73 79 73  n [ encoding sys
02c0: 74 65 6d 5d 20 69 73 20 69 64 65 6e 74 69 74 79  tem] is identity
02d0: 2e 0a 6b 62 6b 09 33 3a 20 53 74 61 73 68 20 74  ..kbk.3: Stash t
02e0: 68 65 20 63 75 72 72 65 6e 74 20 73 79 73 74 65  he current syste
02f0: 6d 20 65 6e 63 6f 64 69 6e 67 20 28 74 6f 20 62  m encoding (to b
0300: 65 20 61 62 6c 65 20 74 6f 20 72 65 73 74 6f 72  e able to restor
0310: 65 20 69 74 20 6c 61 74 65 72 29 0a 6b 62 6b 09  e it later).kbk.
0320: 34 3a 20 53 74 61 73 68 20 74 68 65 20 65 6e 63  4: Stash the enc
0330: 6f 64 69 6e 67 20 64 69 72 73 20 28 74 6f 20 62  oding dirs (to b
0340: 65 20 61 62 6c 65 20 74 6f 20 72 65 73 74 6f 72  e able to restor
0350: 20 6c 61 74 65 72 29 0a 6b 62 6b 09 35 3a 20 53   later).kbk.5: S
0360: 65 74 20 74 68 65 20 73 79 73 74 65 6d 20 65 6e  et the system en
0370: 63 6f 64 69 6e 67 20 74 6f 20 73 68 69 66 74 6a  coding to shiftj
0380: 69 73 2e 0a 6b 62 6b 09 36 3a 20 53 65 74 20 5b  is..kbk.6: Set [
0390: 65 6e 63 6f 64 69 6e 67 20 64 69 72 73 5d 20 74  encoding dirs] t
03a0: 6f 20 74 68 65 20 70 61 74 68 20 74 6f 20 74 68  o the path to th
03b0: 65 20 77 64 2c 20 63 6f 6e 76 65 72 74 65 64 20  e wd, converted 
03c0: 66 72 6f 6d 20 77 68 61 74 65 76 65 72 20 74 68  from whatever th
03d0: 65 20 74 72 75 65 20 73 79 73 74 65 6d 20 65 6e  e true system en
03e0: 63 6f 64 69 6e 67 20 69 73 20 2d 20 61 73 20 69  coding is - as i
03f0: 66 20 74 68 65 20 73 79 73 74 65 6d 20 65 6e 63  f the system enc
0400: 6f 64 69 6e 67 20 77 65 72 65 20 73 68 69 66 74  oding were shift
0410: 6a 69 73 2e 20 28 54 68 65 20 70 61 74 68 20 68  jis. (The path h
0420: 61 64 20 62 65 74 74 65 72 20 62 65 20 70 6c 61  ad better be pla
0430: 69 6e 20 41 53 43 49 49 21 29 0a 6d 69 67 75 65  in ASCII!).migue
0440: 6c 09 74 77 6f 20 6e 6f 74 65 73 3a 20 28 61 29  l.two notes: (a)
0450: 20 49 20 64 6f 20 6e 6f 74 20 67 72 6f 6b 20 74   I do not grok t
0460: 68 65 20 65 6e 63 6f 64 69 6e 67 20 73 74 75 66  he encoding stuf
0470: 66 20 61 74 20 61 6c 6c 3b 20 28 62 29 20 49 20  f at all; (b) I 
0480: 61 6d 20 77 6f 72 72 69 65 64 20 61 62 6f 75 74  am worried about
0490: 20 64 69 66 66 65 72 65 6e 74 20 62 65 68 61 76   different behav
04a0: 69 6f 75 72 20 62 65 74 77 65 65 6e 20 69 6e 74  iour between int
04b0: 65 72 70 72 65 74 65 64 20 61 6e 64 20 63 6f 6d  erpreted and com
04c0: 70 69 6c 65 64 20 28 74 68 61 74 20 73 68 6f 75  piled (that shou
04d0: 6c 64 20 6e 6f 74 20 68 61 70 70 65 6e 2c 20 61  ld not happen, a
04e0: 6e 64 20 49 20 66 61 69 6c 20 74 6f 20 73 65 65  nd I fail to see
04f0: 20 61 6e 79 74 68 69 6e 67 20 64 61 6e 67 65 72   anything danger
0500: 6f 75 73 20 61 62 6f 75 74 20 69 74 20 68 65 72  ous about it her
0510: 65 3a 20 77 68 79 20 64 6f 65 73 20 69 74 3f 29  e: why does it?)
0520: 0a 6b 62 6b 09 37 3a 20 54 72 79 20 74 6f 20 63  .kbk.7: Try to c
0530: 6f 6e 76 65 72 74 20 75 2b 34 65 34 65 20 74 6f  onvert u+4e4e to
0540: 20 73 68 69 66 74 6a 69 73 2e 20 20 54 68 69 73   shiftjis.  This
0550: 20 77 69 6c 6c 20 6c 6f 61 64 20 74 68 65 20 73   will load the s
0560: 68 69 66 74 6a 69 73 20 65 6e 63 6f 64 69 6e 67  hiftjis encoding
0570: 2c 20 61 6e 64 20 6d 61 79 20 64 69 73 6d 69 73  , and may dismis
0580: 73 20 69 74 20 61 67 61 69 6e 20 69 66 20 74 68  s it again if th
0590: 65 20 27 73 68 69 66 74 6a 69 73 27 20 6c 69 74  e 'shiftjis' lit
05a0: 65 72 61 6c 20 6c 6f 73 65 73 20 69 74 73 20 69  eral loses its i
05b0: 6e 74 20 72 65 70 0a 6b 62 6b 09 4f 68 2c 20 73  nt rep.kbk.Oh, s
05c0: 6f 72 72 79 2c 20 37 2e 20 63 61 6e 27 74 20 6c  orry, 7. can't l
05d0: 6f 73 65 20 74 68 65 20 73 68 69 66 74 6a 69 73  ose the shiftjis
05e0: 20 65 6e 63 6f 64 69 6e 67 20 27 63 6f 7a 20 74   encoding 'coz t
05f0: 68 65 20 73 79 73 74 65 6d 20 65 6e 63 6f 64 69  he system encodi
0600: 6e 67 20 69 73 20 68 6f 6c 64 69 6e 67 20 61 20  ng is holding a 
0610: 72 65 66 65 72 65 6e 63 65 20 74 6f 20 69 74 2e  reference to it.
0620: 0a 6b 62 6b 09 49 20 73 74 69 6c 6c 20 74 68 69  .kbk.I still thi
0630: 6e 6b 20 74 68 61 74 20 74 68 65 20 70 72 6f 62  nk that the prob
0640: 6c 65 6d 20 69 73 20 74 68 61 74 20 73 68 69 66  lem is that shif
0650: 74 6a 69 73 20 63 61 6e 27 74 20 62 65 20 66 6f  tjis can't be fo
0660: 75 6e 64 20 77 69 74 68 20 5b 65 6e 63 6f 64 69  und with [encodi
0670: 6e 67 20 73 79 73 74 65 6d 5d 20 61 6e 64 20 5b  ng system] and [
0680: 65 6e 63 6f 64 69 6e 67 20 64 69 72 73 5d 20 73  encoding dirs] s
0690: 65 74 20 74 68 65 20 77 61 79 20 74 68 65 79 20  et the way they 
06a0: 61 72 65 2e 2e 2e 20 74 68 61 74 27 73 20 74 68  are... that's th
06b0: 65 20 74 72 75 65 20 62 75 67 2e 0a 6b 62 6b 09  e true bug..kbk.
06c0: 42 75 74 20 74 68 65 6e 20 74 68 65 20 62 75 67  But then the bug
06d0: 20 69 73 20 6d 61 73 6b 65 64 20 69 6e 20 6f 6e   is masked in on
06e0: 65 20 63 61 73 65 20 61 6e 64 20 6e 6f 74 20 74  e case and not t
06f0: 68 65 20 6f 74 68 65 72 20 62 79 20 64 69 66 66  he other by diff
0700: 65 72 65 6e 74 20 6c 69 74 65 72 61 6c 20 6c 69  erent literal li
0710: 66 65 74 69 6d 65 73 2c 20 77 68 65 72 65 20 74  fetimes, where t
0720: 68 65 20 65 6e 63 6f 64 69 6e 67 20 69 73 20 63  he encoding is c
0730: 61 63 68 65 64 20 69 6e 20 74 68 65 20 69 6e 74  ached in the int
0740: 20 72 65 70 20 6f 66 20 74 68 65 20 27 73 68 69   rep of the 'shi
0750: 66 74 6a 69 73 27 20 6c 69 74 65 72 61 6c 2e 0a  ftjis' literal..
0760: 6b 62 6b 09 41 6e 64 20 74 68 69 73 20 74 65 73  kbk.And this tes
0770: 74 20 6c 6f 6f 6b 73 20 74 68 6f 72 6f 75 67 68  t looks thorough
0780: 6c 79 20 62 6f 67 75 73 20 2d 20 49 20 73 65 65  ly bogus - I see
0790: 20 6e 6f 20 72 65 61 73 6f 6e 20 74 6f 20 65 78   no reason to ex
07a0: 70 65 63 74 20 69 74 20 74 6f 20 77 6f 72 6b 20  pect it to work 
07b0: 77 69 74 68 20 5b 65 6e 63 6f 64 69 6e 67 20 73  with [encoding s
07c0: 79 73 74 65 6d 5d 20 73 65 74 20 77 72 6f 6e 67  ystem] set wrong
07d0: 2e 0a 6d 69 67 75 65 6c 09 61 68 68 68 20 2e 2e  ..miguel.ahhh ..
07e0: 2e 20 6e 6f 77 20 49 20 73 65 65 20 77 68 65 72  . now I see wher
07f0: 65 20 79 6f 75 20 61 72 65 20 67 6f 69 6e 67 0a  e you are going.
0800: 6d 69 67 75 65 6c 09 65 6e 63 6f 64 69 6e 67 2d  miguel.encoding-
0810: 31 31 2e 31 20 73 65 65 6d 73 20 74 6f 20 62 65  11.1 seems to be
0820: 20 74 68 65 20 73 61 6d 65 20 74 68 69 6e 67 0a   the same thing.
0830: 6b 62 6b 09 4d 69 67 68 74 20 6e 65 65 64 20 74  kbk.Might need t
0840: 6f 20 72 65 70 6c 61 63 65 20 74 68 65 20 27 73  o replace the 's
0850: 68 69 66 74 6a 69 73 27 20 74 68 72 6f 75 67 68  hiftjis' through
0860: 6f 75 74 20 77 69 74 68 20 73 6f 6d 65 74 68 69  out with somethi
0870: 6e 67 20 6c 69 6b 65 20 5b 6a 6f 69 6e 20 7b 73  ng like [join {s
0880: 68 69 66 74 20 6a 69 73 7d 20 7b 7d 5d 20 74 6f  hift jis} {}] to
0890: 20 64 65 66 65 61 74 20 69 6e 74 20 72 65 70 20   defeat int rep 
08a0: 63 61 63 68 69 6e 67 2e 2e 2e 20 61 6e 64 20 74  caching... and t
08b0: 68 65 6e 20 72 65 70 6f 72 74 20 69 74 20 61 73  hen report it as
08c0: 20 61 6e 20 65 6e 63 6f 64 69 6e 67 20 62 75 67   an encoding bug
08d0: 0a 6b 62 6b 09 28 50 72 6f 62 61 62 6c 79 20 61  .kbk.(Probably a
08e0: 73 20 61 20 62 6f 67 75 73 20 74 65 73 74 2c 20  s a bogus test, 
08f0: 73 69 6e 63 65 20 75 73 69 6e 67 20 74 68 65 20  since using the 
0900: 66 69 6c 65 73 79 73 74 65 6d 20 77 69 74 68 20  filesystem with 
0910: 5b 65 6e 63 6f 64 69 6e 67 20 73 79 73 74 65 6d  [encoding system
0920: 5d 20 73 65 74 20 69 6e 63 6f 72 72 65 63 74 6c  ] set incorrectl
0930: 79 20 69 73 20 61 20 68 6f 72 72 69 62 6c 79 2c  y is a horribly,
0940: 20 65 79 65 2d 70 6f 70 70 69 6e 67 6c 79 2c 20   eye-poppingly, 
0950: 66 61 63 65 2d 73 6c 61 70 70 69 6e 67 6c 79 2c  face-slappingly,
0960: 20 62 61 64 20 74 68 69 6e 67 20 74 6f 20 64 6f   bad thing to do
0970: 2e 0a 6b 62 6b 09 29 0a 6d 69 67 75 65 6c 09 6e  ..kbk.).miguel.n
0980: 6f 74 20 73 75 72 65 20 49 27 64 20 6b 6e 6f 77  ot sure I'd know
0990: 20 77 68 61 74 20 74 6f 20 72 65 70 6f 72 74 20   what to report 
09a0: 28 79 65 74 29 20 2d 20 61 73 20 49 20 61 6d 20  (yet) - as I am 
09b0: 6e 6f 74 20 73 75 72 65 20 77 68 61 74 20 69 73  not sure what is
09c0: 20 73 75 70 70 6f 73 65 64 20 74 6f 20 62 65 20   supposed to be 
09d0: 68 61 70 70 65 6e 69 6e 67 0a 6b 62 6b 09 44 6f  happening.kbk.Do
09e0: 69 6e 67 20 73 6f 20 68 61 70 70 65 6e 73 20 74  ing so happens t
09f0: 6f 20 77 6f 72 6b 20 61 20 67 6f 6f 64 20 70 61  o work a good pa
0a00: 72 74 20 6f 66 20 74 68 65 20 74 69 6d 65 20 62  rt of the time b
0a10: 65 63 61 75 73 65 20 6d 6f 73 74 20 66 69 6c 65  ecause most file
0a20: 73 79 73 74 65 6d 20 65 6e 63 6f 64 69 6e 67 73  system encodings
0a30: 20 68 61 76 65 20 41 53 43 49 49 20 61 73 20 61   have ASCII as a
0a40: 20 70 72 6f 70 65 72 20 73 75 62 73 65 74 2e 2e   proper subset..
0a50: 2e 0a 6b 62 6b 09 2e 2e 2e 20 62 75 74 20 74 68  ..kbk.... but th
0a60: 61 74 20 69 73 20 62 79 20 6e 6f 20 6d 65 61 6e  at is by no mean
0a70: 73 20 67 75 61 72 61 6e 74 65 65 64 2e 0a 6d 69  s guaranteed..mi
0a80: 67 75 65 6c 09 74 68 65 20 66 69 6c 65 73 79 73  guel.the filesys
0a90: 74 65 6d 20 75 73 61 67 65 20 69 73 20 65 61 73  tem usage is eas
0aa0: 79 20 65 6e 6f 75 67 68 20 74 6f 20 62 79 70 61  y enough to bypa
0ab0: 73 73 2c 20 72 69 67 68 74 3f 0a 6b 62 6b 09 49  ss, right?.kbk.I
0ac0: 20 64 6f 6e 27 74 20 74 68 69 6e 6b 20 73 6f 3b   don't think so;
0ad0: 20 74 68 69 73 20 74 65 73 74 20 73 65 65 6d 73   this test seems
0ae0: 20 74 6f 20 62 65 20 74 72 79 69 6e 67 20 74 6f   to be trying to
0af0: 20 66 6f 72 63 65 20 69 74 20 74 6f 20 67 6f 20   force it to go 
0b00: 74 6f 20 74 68 65 20 66 69 6c 65 73 79 73 74 65  to the filesyste
0b10: 6d 20 28 70 65 72 68 61 70 73 20 69 6e 20 6f 72  m (perhaps in or
0b20: 64 65 72 20 74 6f 20 74 65 73 74 20 74 68 61 74  der to test that
0b30: 20 69 74 20 61 63 74 75 61 6c 6c 79 20 64 6f 65   it actually doe
0b40: 73 29 0a 6d 69 67 75 65 6c 09 73 65 74 20 64 69  s).miguel.set di
0b50: 72 73 20 5b 6c 69 73 74 20 5b 70 77 64 5d 5d 0a  rs [list [pwd]].
0b60: 09 65 6e 63 6f 64 69 6e 67 20 73 79 73 74 65 6d  .encoding system
0b70: 20 73 68 69 66 74 6a 69 73 20 3b 23 20 69 6e 63   shiftjis ;# inc
0b80: 72 20 72 65 66 20 63 6f 75 6e 74 0a 09 65 6e 63  r ref count..enc
0b90: 6f 64 69 6e 67 20 64 69 72 73 20 24 64 69 72 73  oding dirs $dirs
0ba0: 0a 6b 62 6b 09 55 68 6d 2c 20 74 68 65 20 5b 65  .kbk.Uhm, the [e
0bb0: 6e 63 6f 64 69 6e 67 20 64 69 72 73 5d 20 69 73  ncoding dirs] is
0bc0: 20 73 75 70 70 6f 73 65 64 20 74 6f 20 67 65 74   supposed to get
0bd0: 20 72 69 64 20 6f 66 20 63 61 63 68 65 64 20 65   rid of cached e
0be0: 6e 63 6f 64 69 6e 67 73 2c 20 61 6e 64 20 74 68  ncodings, and th
0bf0: 65 6e 20 5b 65 6e 63 6f 64 69 6e 67 20 63 6f 6e  en [encoding con
0c00: 76 65 72 74 74 6f 5d 20 69 73 20 73 75 70 70 6f  vertto] is suppo
0c10: 73 65 64 20 74 6f 20 62 65 20 67 6f 69 6e 67 20  sed to be going 
0c20: 74 6f 20 74 68 65 20 66 69 6c 65 73 79 73 74 65  to the filesyste
0c30: 6d 20 74 6f 20 6c 6f 61 64 20 74 68 65 20 65 6e  m to load the en
0c40: 63 6f 64 69 6e 67 20 74 61 62 6c 65 20 61 6c 6c  coding table all
0c50: 20 6f 76 65 72 20 61 67 61 69 6e 2e 0a 6b 62 6b   over again..kbk
0c60: 09 49 20 74 68 69 6e 6b 2e 0a 6d 69 67 75 65 6c  .I think..miguel
0c70: 09 77 68 61 74 20 49 20 74 68 6f 75 67 68 74 20  .what I thought 
0c80: 73 68 6f 75 6c 64 20 62 65 20 68 61 70 70 65 6e  should be happen
0c90: 69 6e 67 20 69 73 3a 20 61 73 20 73 68 69 66 74  ing is: as shift
0ca0: 6a 69 73 20 69 73 20 6e 6f 74 20 74 6f 20 62 65  jis is not to be
0cb0: 20 66 6f 75 6e 64 20 69 6e 20 5b 65 6e 63 6f 64   found in [encod
0cc0: 69 6e 67 20 64 69 72 73 5d 2c 20 74 68 65 20 74  ing dirs], the t
0cd0: 68 69 6e 67 20 73 68 6f 75 6c 64 20 66 61 69 6c  hing should fail
0ce0: 2e 20 53 6f 2c 20 73 65 74 20 5b 65 6e 63 6f 64  . So, set [encod
0cf0: 69 6e 67 20 64 69 72 73 5d 20 74 6f 20 61 6e 79  ing dirs] to any
0d00: 74 68 69 6e 67 20 77 68 65 72 65 20 74 68 65 20  thing where the 
0d10: 65 6e 63 6f 64 69 6e 67 20 69 73 20 6e 6f 74 20  encoding is not 
0d20: 74 6f 20 62 65 20 66 6f 75 6e 64 2e 20 5b 70 77  to be found. [pw
0d30: 64 5d 20 69 73 20 74 68 65 20 6f 62 76 69 6f 75  d] is the obviou
0d40: 73 20 63 68 65 61 70 20 63 68 6f 69 63 65 0a 6b  s cheap choice.k
0d50: 62 6b 09 41 6e 64 20 73 6f 20 69 74 20 63 6f 75  bk.And so it cou
0d60: 6c 64 20 62 65 20 74 68 61 74 20 65 6e 63 6f 64  ld be that encod
0d70: 69 6e 67 20 2a 61 6c 73 6f 2a 20 68 61 73 20 61  ing *also* has a
0d80: 20 62 75 67 20 77 74 68 20 69 74 73 20 65 70 6f   bug wth its epo
0d90: 63 68 20 6d 61 6e 61 67 65 6d 65 6e 74 2e 0a 6b  ch management..k
0da0: 62 6b 09 41 68 2e 2e 2e 20 49 20 77 61 73 20 6c  bk.Ah... I was l
0db0: 6f 6f 6b 69 6e 67 20 61 74 20 2a 79 6f 75 72 2a  ooking at *your*
0dc0: 20 63 61 73 65 2c 20 61 6e 64 20 68 61 64 6e 27   case, and hadn'
0dd0: 74 20 70 75 6c 6c 65 64 20 75 70 20 65 6e 63 6f  t pulled up enco
0de0: 64 69 6e 67 2d 32 2e 32 2e 0a 6d 69 67 75 65 6c  ding-2.2..miguel
0df0: 09 6d 79 20 63 61 73 65 20 2a 69 73 2a 20 65 6e  .my case *is* en
0e00: 63 6f 64 69 6e 67 2d 32 2e 32 2c 20 63 6f 70 79  coding-2.2, copy
0e10: 2f 70 61 73 74 65 64 0a 6b 62 6b 09 42 75 74 20  /pasted.kbk.But 
0e20: 49 20 64 69 64 6e 27 74 20 6b 6e 6f 77 20 77 68  I didn't know wh
0e30: 69 63 68 20 6f 66 20 79 6f 75 72 20 74 77 6f 20  ich of your two 
0e40: 72 65 73 75 6c 74 73 20 77 61 73 20 63 6f 72 72  results was corr
0e50: 65 63 74 21 0a 6d 69 67 75 65 6c 09 6f 6b 0a 6b  ect!.miguel.ok.k
0e60: 62 6b 09 48 6d 6d 6d 2e 20 49 20 64 6f 6e 27 74  bk.Hmmm. I don't
0e70: 20 65 76 65 6e 20 6b 6e 6f 77 20 69 66 20 65 6e   even know if en
0e80: 63 6f 64 69 6e 67 20 63 61 63 68 65 73 20 73 74  coding caches st
0e90: 75 66 66 20 6f 6e 20 69 6e 74 20 72 65 70 73 2c  uff on int reps,
0ea0: 20 77 69 74 68 6f 75 74 20 6c 6f 6f 6b 69 6e 67   without looking
0eb0: 2e 0a 6b 62 6b 09 42 75 74 20 69 66 20 69 74 20  ..kbk.But if it 
0ec0: 64 6f 65 73 2c 20 74 68 65 6e 20 69 74 27 73 20  does, then it's 
0ed0: 67 6f 74 20 61 20 62 75 67 20 77 69 74 68 20 65  got a bug with e
0ee0: 70 6f 63 68 20 6d 61 6e 61 67 65 6d 65 6e 74 2e  poch management.
0ef0: 0a 6b 62 6b 09 28 41 6e 64 20 5b 70 77 64 5d 20  .kbk.(And [pwd] 
0f00: 6d 69 73 65 6e 63 6f 64 65 64 20 69 73 20 61 6c  misencoded is al
0f10: 73 6f 20 61 20 63 68 65 61 70 20 27 6e 6f 74 20  so a cheap 'not 
0f20: 74 68 65 72 65 27 2c 20 73 6f 20 49 20 77 6f 6e  there', so I won
0f30: 27 74 20 77 6f 72 72 79 20 74 6f 6f 20 6d 75 63  't worry too muc
0f40: 68 20 61 62 6f 75 74 20 61 6c 6c 20 74 68 65 20  h about all the 
0f50: 5b 65 6e 63 6f 64 69 6e 67 20 73 79 73 74 65 6d  [encoding system
0f60: 5d 20 73 74 75 66 66 29 0a 6b 62 6b 09 49 74 20  ] stuff).kbk.It 
0f70: 61 70 70 65 61 72 73 20 74 68 61 74 20 5b 65 6e  appears that [en
0f80: 63 6f 64 69 6e 67 20 64 69 72 73 5d 20 69 73 20  coding dirs] is 
0f90: 63 68 61 6e 67 69 6e 67 20 74 68 65 20 65 6e 63  changing the enc
0fa0: 6f 64 69 6e 67 20 70 61 74 68 2c 20 62 75 74 20  oding path, but 
0fb0: 74 68 65 20 27 73 68 69 66 74 6a 69 73 27 20 65  the 'shiftjis' e
0fc0: 6e 63 6f 64 69 6e 67 2c 20 70 72 65 73 75 6d 61  ncoding, presuma
0fd0: 62 6c 79 20 63 61 63 68 65 64 20 6f 6e 20 74 68  bly cached on th
0fe0: 65 20 6c 69 74 65 72 61 6c 27 73 20 69 6e 74 65  e literal's inte
0ff0: 72 6e 61 6c 20 72 65 70 2c 20 69 73 20 70 65 72  rnal rep, is per
1000: 73 69 73 74 69 6e 67 2e 0a 6b 62 6b 09 41 6e 64  sisting..kbk.And
1010: 20 69 74 20 63 6f 75 6c 64 20 62 65 20 74 68 61   it could be tha
1020: 74 20 69 74 27 73 20 73 69 6d 70 6c 79 20 61 20  t it's simply a 
1030: 6d 61 74 74 65 72 20 74 68 61 74 20 74 68 69 73  matter that this
1040: 20 62 75 67 20 68 61 73 20 62 65 65 6e 20 74 68   bug has been th
1050: 65 72 65 20 66 6f 72 20 61 20 6c 6f 6e 67 20 74  ere for a long t
1060: 69 6d 65 2c 20 62 75 74 20 74 68 61 74 20 74 68  ime, but that th
1070: 65 20 6c 69 74 65 72 61 6c 20 69 73 20 73 68 61  e literal is sha
1080: 72 65 64 20 6d 6f 72 65 20 77 69 64 65 6c 79 20  red more widely 
1090: 74 68 61 6e 20 69 74 20 77 61 73 2c 20 6f 72 20  than it was, or 
10a0: 64 6f 65 73 6e 27 74 20 73 68 69 6d 6d 65 72 2c  doesn't shimmer,
10b0: 20 6f 72 20 73 6f 6d 65 20 73 75 63 68 2e 0a 6d   or some such..m
10c0: 69 67 75 65 6c 09 31 31 2e 31 20 69 73 20 61 20  iguel.11.1 is a 
10d0: 62 69 74 20 64 69 66 66 65 72 65 6e 74 3b 20 49  bit different; I
10e0: 20 61 6c 73 6f 20 67 65 74 20 61 20 66 61 69 6c   also get a fail
10f0: 75 72 65 20 74 68 65 72 65 20 2e 2e 2e 20 62 75  ure there ... bu
1100: 74 20 69 74 20 6d 69 67 68 74 20 77 65 6c 6c 20  t it might well 
1110: 62 65 20 61 20 73 69 64 65 2d 65 66 66 65 63 74  be a side-effect
1120: 20 6f 66 20 74 68 65 20 70 72 65 76 69 6f 75 73   of the previous
1130: 20 6f 6e 65 20 28 73 68 69 66 74 6a 69 73 20 69   one (shiftjis i
1140: 73 20 69 6e 20 74 68 65 20 6c 69 74 65 72 61 6c  s in the literal
1150: 20 66 6f 72 20 74 68 65 20 69 6e 74 65 72 70 27   for the interp'
1160: 73 20 6c 69 66 65 74 69 6d 65 29 0a 6b 62 6b 09  s lifetime).kbk.
1170: 59 65 73 2c 20 65 6e 63 6f 64 69 6e 67 73 20 64  Yes, encodings d
1180: 6f 20 67 65 74 20 63 61 63 68 65 64 20 69 6e 20  o get cached in 
1190: 61 6e 20 6f 62 6a 27 73 20 69 6e 74 20 72 65 70  an obj's int rep
11a0: 2e 0a 6b 62 6b 09 41 6e 64 20 49 20 64 6f 6e 27  ..kbk.And I don'
11b0: 74 20 73 65 65 20 61 6e 79 74 68 69 6e 67 20 69  t see anything i
11c0: 6e 20 74 63 6c 45 6e 63 6f 64 69 6e 67 2e 63 20  n tclEncoding.c 
11d0: 74 6f 20 73 70 6f 69 6c 20 74 68 65 20 63 61 63  to spoil the cac
11e0: 68 65 20 77 68 65 6e 20 5b 65 6e 63 6f 64 69 6e  he when [encodin
11f0: 67 20 64 69 72 73 5d 20 63 68 61 6e 67 65 73 2e  g dirs] changes.
1200: 0a 6b 62 6b 09 49 20 74 68 69 6e 6b 20 74 68 65  .kbk.I think the
1210: 20 61 73 73 75 6d 70 74 69 6f 6e 20 6d 61 79 20   assumption may 
1220: 62 65 20 74 68 61 74 20 61 6e 20 65 6e 63 6f 64  be that an encod
1230: 69 6e 67 20 69 73 20 66 69 78 65 64 2c 20 61 6e  ing is fixed, an
1240: 64 20 61 20 63 68 61 6e 67 65 20 74 6f 20 5b 65  d a change to [e
1250: 6e 63 6f 64 69 6e 67 20 64 69 72 73 5d 20 77 6f  ncoding dirs] wo
1260: 6e 27 74 20 61 66 66 65 63 74 20 61 6e 79 20 65  n't affect any e
1270: 6e 63 6f 64 69 6e 67 20 74 68 61 74 20 68 61 73  ncoding that has
1280: 20 62 65 65 6e 20 72 65 73 6f 6c 76 65 64 20 73   been resolved s
1290: 75 63 63 65 73 73 66 75 6c 6c 79 2e 0a 6b 62 6b  uccessfully..kbk
12a0: 09 41 6e 64 20 74 68 61 74 27 73 20 6e 6f 74 20  .And that's not 
12b0: 61 20 74 65 72 72 69 62 6c 65 20 61 73 73 75 6d  a terrible assum
12c0: 70 74 69 6f 6e 2c 20 61 63 74 75 61 6c 6c 79 2e  ption, actually.
12d0: 2e 2e 0a 6b 62 6b 09 2e 2e 2e 20 62 75 74 20 74  ...kbk.... but t
12e0: 68 65 73 65 20 74 65 73 74 73 20 73 65 65 6d 20  hese tests seem 
12f0: 74 6f 20 62 65 20 74 72 79 69 6e 67 20 74 6f 20  to be trying to 
1300: 6d 61 6b 65 20 73 75 72 65 20 74 68 61 74 20 65  make sure that e
1310: 78 74 61 6e 74 20 65 6e 63 6f 64 69 6e 67 73 20  xtant encodings 
1320: 61 72 65 20 73 70 6f 69 6c 74 20 77 68 65 6e 20  are spoilt when 
1330: 74 68 65 20 65 6e 63 6f 64 69 6e 67 20 70 61 74  the encoding pat
1340: 68 20 63 68 61 6e 67 65 73 2e 0a 6d 69 67 75 65  h changes..migue
1350: 6c 09 68 6d 6d 6d 20 2e 2e 2e 20 69 74 20 73 65  l.hmmm ... it se
1360: 65 6d 73 20 74 6f 20 62 65 20 72 65 6c 79 69 6e  ems to be relyin
1370: 67 20 6f 6e 20 54 63 6c 5f 44 65 63 72 52 65 66  g on Tcl_DecrRef
1380: 43 6f 75 6e 74 20 74 6f 20 64 6f 20 74 68 65 20  Count to do the 
1390: 73 70 6f 69 6c 69 6e 67 2c 20 74 68 65 6e 3f 20  spoiling, then? 
13a0: 57 68 69 63 68 20 69 73 20 6e 6f 74 20 65 6e 6f  Which is not eno
13b0: 75 67 68 20 2d 20 74 68 65 20 74 68 69 6e 67 20  ugh - the thing 
13c0: 63 6f 75 6c 64 20 62 65 20 73 68 61 72 65 64 20  could be shared 
13d0: 28 61 73 20 69 74 20 69 73 20 69 66 20 69 74 20  (as it is if it 
13e0: 69 73 20 61 20 6c 69 74 65 72 61 6c 29 0a 6b 62  is a literal).kb
13f0: 6b 09 49 20 74 68 69 6e 6b 20 74 68 61 74 20 65  k.I think that e
1400: 69 74 68 65 72 20 28 61 29 20 77 65 20 64 65 63  ither (a) we dec
1410: 69 64 65 20 74 68 69 73 20 69 73 20 4e 6f 74 20  ide this is Not 
1420: 41 20 42 75 67 20 2d 20 74 68 65 20 27 73 68 69  A Bug - the 'shi
1430: 66 74 6a 69 73 27 20 65 6e 63 6f 64 69 6e 67 20  ftjis' encoding 
1440: 73 68 6f 75 6c 64 20 62 65 20 74 68 65 20 73 61  should be the sa
1450: 6d 65 20 65 76 65 72 79 77 68 65 72 65 20 70 72  me everywhere pr
1460: 6f 76 69 64 65 64 20 74 68 61 74 20 69 74 20 69  ovided that it i
1470: 73 20 66 6f 75 6e 64 20 61 74 20 61 6c 6c 2c 20  s found at all, 
1480: 6f 72 20 28 62 29 20 74 68 61 74 20 77 65 20 6e  or (b) that we n
1490: 65 65 64 20 61 6e 20 65 70 6f 63 68 20 6e 75 6d  eed an epoch num
14a0: 62 65 72 20 69 6e 20 74 68 65 20 63 61 63 68 65  ber in the cache
14b0: 20 6f 66 20 65 6e 63 6f 64 69 6e 67 73 20 28 6a   of encodings (j
14c0: 75 73 74 20 61 73 20 77 65 20 68 61 76 65 20 69  ust as we have i
14d0: 6e 20 73 6f 20 6d 61 6e 79 20 6f 66 20 6f 75 72  n so many of our
14e0: 20 6f 74 68 65 72 20 63 61 63 68 65 73 29 0a 6b   other caches).k
14f0: 62 6b 09 42 75 74 20 2a 74 68 61 74 2a 20 70 61  bk.But *that* pa
1500: 72 74 20 69 73 20 66 6f 72 20 74 68 65 20 6d 61  rt is for the ma
1510: 69 6e 74 61 69 6e 65 72 20 6f 66 20 74 63 6c 45  intainer of tclE
1520: 6e 63 6f 64 69 6e 67 2e 63 20 74 6f 20 73 6f 72  ncoding.c to sor
1530: 74 20 6f 75 74 2e 0a 6d 69 67 75 65 6c 09 6d 79  t out..miguel.my
1540: 20 74 61 6b 65 20 74 68 65 6e 20 69 73 20 74 68   take then is th
1550: 61 74 20 49 20 73 68 6f 75 6c 64 20 69 67 6e 6f  at I should igno
1560: 72 65 20 74 68 69 73 20 74 65 73 74 20 66 61 69  re this test fai
1570: 6c 75 72 65 20 28 69 6e 20 74 68 65 20 73 65 6e  lure (in the sen
1580: 73 65 20 74 68 61 74 20 69 74 20 69 73 20 6e 6f  se that it is no
1590: 74 20 61 20 62 75 67 20 69 6e 20 62 63 27 69 6e  t a bug in bc'in
15a0: 67 20 75 70 6c 65 76 65 6c 29 2c 20 61 6e 64 20  g uplevel), and 
15b0: 66 69 6c 65 20 61 6e 20 65 6e 63 6f 64 69 6e 67  file an encoding
15c0: 20 62 75 67 2e 20 52 69 67 68 74 3f 0a 6b 62 6b   bug. Right?.kbk
15d0: 09 52 69 67 68 74 2e 20 20 49 20 73 75 73 70 65  .Right.  I suspe
15e0: 63 74 20 69 74 27 73 20 6a 75 73 74 20 74 68 61  ct it's just tha
15f0: 74 20 74 68 65 20 62 63 63 20 68 61 73 20 67 6f  t the bcc has go
1600: 74 74 65 6e 20 6d 6f 72 65 20 65 66 66 69 63 69  tten more effici
1610: 65 6e 74 2c 20 61 6e 64 20 77 65 27 72 65 20 6e  ent, and we're n
1620: 6f 77 20 70 65 72 73 69 73 74 69 6e 67 20 61 20  ow persisting a 
1630: 75 73 65 66 75 6c 20 69 6e 74 20 72 65 70 20 74  useful int rep t
1640: 68 61 74 20 77 65 20 70 72 65 76 69 6f 75 73 6c  hat we previousl
1650: 79 20 6c 6f 73 74 2e 0a 6b 62 6b 09 44 6f 65 73  y lost..kbk.Does
1660: 20 69 74 20 73 75 63 63 65 65 64 20 69 66 20 79   it succeed if y
1670: 6f 75 20 72 65 70 6c 61 63 65 20 61 6c 6c 20 74  ou replace all t
1680: 68 65 20 27 73 68 69 66 74 6a 69 73 27 20 6c 69  he 'shiftjis' li
1690: 74 65 72 61 6c 73 20 77 69 74 68 20 5b 6a 6f 69  terals with [joi
16a0: 6e 20 7b 73 68 69 66 74 20 6a 69 73 7d 20 7b 7d  n {shift jis} {}
16b0: 5d 20 6f 72 20 73 6f 6d 65 20 73 75 63 68 3f 0a  ] or some such?.
16c0: 6d 69 67 75 65 6c 09 6e 6f 20 66 61 69 6c 75 72  miguel.no failur
16d0: 65 20 77 68 65 6e 20 75 73 69 6e 67 20 5b 6a 6f  e when using [jo
16e0: 69 6e 20 7b 73 68 69 66 74 20 6a 69 73 7d 20 7b  in {shift jis} {
16f0: 7d 5d 20 2e 2e 2e 20 63 61 63 68 69 6e 67 20 68  }] ... caching h
1700: 79 70 6f 74 68 65 73 69 73 20 63 6f 6e 66 69 72  ypothesis confir
1710: 6d 65 64 0a                                      med.