Overview
| Artifact ID: | f5fd8a52311523c82d7d300fcf23f6074b4c96bc |
|---|---|
| Ticket: | 523988ffffffffffffffffffffffffffffffffff
Decoding broken for iso-2022-jp |
| User & Date: | atfrost on 2002-02-28 18:39:42 |
Changes
- assignee changed to: "nijtmans"
- cmimetype changed to: "text/plain"
- comment changed to:
Tcl 8.3.4 does not decode iso-2022-jp data properly under certain conditions. Attached is a file "iso2022.sample". This file is also located at http://www.nevernever.org/iso2022.sample When this file is read line-by-line using "gets", only the first 62 bytes of each line are decoded properly. The remainder of the line is decoded as rubbish, eg. a string literal such as: %e%"%&%H$N:]$N A sample of the garbled output (reencoded in iso-2022- jp) can be found at http://www.nevernever.org/iso2022.out Here is a code segment which will produce output with mangled lines in $msg: set f [ open $filename r ] fconfigure $f -encoding iso2022-jp set msg "" while { ![eof $f] } { set line [ gets $f ] append msg "$line\n" } close $f Interestingly, this problem is not exhibited when the file is read using "read", as in: set f [ open $filename r ] fconfigure $f -encoding iso2022-jp set msg [ read $f ] close $f A Usenet thread discussing this issue (subject was "trouble decoding iso2022-jp") can be found at http://groups.google.com/groups? hl=en&frame=right&th=b7c438757333dab2 Jeff Hobbs posted: "OK, on this one Thomas keyed me in by pointing out that only his strict example fails (using gets - read is OK). So I honed in on that, and was further keyed in that he noted only X chars ever get translated. Poking around, I found the problem in tclIO.c:FilterInputBytes. It has something to do with the value of the ENCODING_LINESIZE #define (currently 30). If I bump that up to 60, I can read Thomas' sample just fine, and if I drop it to 20, it stops the correct encoding translation even earlier per line. That's obviously not a correct fix, but it does indicate that FilterInputBytes isn't encoding right. I'll have to look into this more when it's not past midnight ..." - foundin changed to: "obsolete: 8.3.4"
- priority changed to: "5 Medium"
- resolution changed to: "None"
- status changed to: "Open"
- submitter changed to: "atfrost"
- subsystem changed to: "44. UTF-8 Strings"
- title changed to: "Decoding broken for iso-2022-jp"
- type changed to: "Bug"