Version 8 of Problems with Tclkitsh 8.5.7

Updated 2009-07-25 04:45:37 by LVwikignoming

Mho: I wonder if there are any differences between tclkitsh 8.4.19 and 8.5.7 regarding encodings.

In several of my win32 starpacks I include the codepages cp437 (and/or cp850) and initialize like that (because otherwise encoding problems with the console occur):

 :
 # http://wiki.tcl.tk/52 ff.
 # http://wiki.tcl.tk/3661
 if {[info commands librarypath] == "librarypath"} {
    librarypath $libRoot
 }
 foreach {channel} {stdin stdout stderr} {
    fconfigure $channel -encoding cp850; # or 437?        
 }     
 :

If I now 'compile' the unchanged program with a 8.5.7 runtime, the program just seems to stop at the fconfigure stdout-step, displaying ugly output like ???????????????? ?????????? ??????????? or so. I had to comment out every fconfigure in the program. Just CATCHing doesn't help.


PT: In Tcl 8.5 on Windows XP your console is a unicode console and so tcl sets the channel encoding to unicode. When you force it to cp850 you introduce a mismatch with the console which is expecting unicode and it tries to present your cp850 bytestream as if it were unicode, thus generating garbage. Don't do this for 8.5+.