Artifacts Associated With Ticket 5b5ba0aa0d0c7863
Ticket change [c69344393a] (rid 196589) by gingerbeardman on 2021-11-15 21:01:14:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/plain"
- comment initialized to:
It seems that the macJapan encoding is incomplete in that it does not deal with the full range of characters as outlined in the spec. https://unicode.org/Public/MAPPINGS/VENDORS/APPLE/JAPANESE.TXT Background: I am spitting out raw filename data from Japanese CD-ROMs (using hfsutils' hls command) and receive the following stream of bytes: 3A90 BB95 6991 CC8C B194 C53A (I list the byte streams so you can easily reproduce this data) these bytes should be encoded to: 3AE8 A3BD E593 81E4 BD93 E9A8 93E7 8988 3A0A (the correct UTF-8 representation is :製品体験版: the commas are part of the text) but using Tcl [encoding convertfrom macJapan] it is encoded to: 3AE8 A3BD E593 81C2 910C EFBD B1E7 8988 3A0A The problematic bytes in this example are: 91CC (should be mapped to 4F53, but Tcl maps to E4BD 93) 8CB1 (should be mapped to 9A13, but Tcl maps to E9A8 93) It's odd that they are encoded into three bytes? These characters are in the range covered by JIS X0208-1990, but please be aware I have not done any investigation to see how deep this problem goes. Finally, I see in https://core.tcl-lang.org/tcl/info/535705ffffffffff that encoding problems will generate errors in future, which is great! That would really help.
- foundin initialized to: "8.5.9"
- is_private initialized to: "0"
- login: "gingerbeardman"
- priority initialized to: "5 Medium"
- private_contact initialized to: "58d078b5c35ea0d0420ca553025ffab67e7e91f5"
- resolution initialized to: "None"
- severity initialized to: "Minor"
- status initialized to: "Open"
- submitter initialized to: "gingerbeardman"
- subsystem initialized to: "- New Builtin Commands"
- title initialized to: "macJapanese encoding is incomplete"
- type initialized to: "Bug"
Ticket change [82a3e50359] (rid 196590) by jan.nijtmans on 2021-11-16 08:30:39:
- icomment:
Thanks for your report. The "macJapan" encoding is defined here: [https://opensource.apple.com/source/tcl/tcl-10/tcl/tools/encoding/macJapan.txt]. I don't think we can simply change that to the definition you are pointing to. I would be possible to add "japanese" as new encoding, the same with other encodings in the [https://www.unicode.org/Public/MAPPINGS/VENDORS/APPLE/] directory. Would that help you? Any others in this list you would like?
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- icomment:
Ticket change [069c2f9989] (rid 196597) by jan.nijtmans on 2021-11-16 13:04:40:
- assignee changed to: "jan.nijtmans"
- login: "jan.nijtmans"
- mimetype: "text/plain"
- type changed to: "RFE"
Ticket change [f646b575ae] (rid 196618) by gingerbeardman on 2021-11-17 10:23:14:
- icomment:
Thanks for the link to Apple's Tcl encoding document, I was not aware of it. The mapping is the same as the one I quoted but the Tcl document has implementation details. It's good! No correction needed. So, I did some more investigation. My code operated normally over stdin, so in fact this issue was because I was not treating the input file as binary to the required degree. I was doing: set in [open $f rb] ...but that was not enough. I also required: fconfigure $in -translation binary ...to get everything working correctly. I'm too new to Tcl to understand why rb alone was not enough. All to say, I no longer think there is a bug. Sorry for the false alarm! I don't have a need for any further encodings, the existing set is good.
- login: "gingerbeardman"
- mimetype: "text/plain"
- username: "gingerbeardman"
- icomment:
Ticket change [dd93cb26cc] (rid 196619) by jan.nijtmans on 2021-11-17 10:31:11:
- closedate changed to: "2459535.93832722"
- closer changed to: "jan.nijtmans"
- icomment:
In that case, I'm closing this one. I already did an [c26e3294a8bbd267|experiment], adding the "japanese" encoding, but if no-one needs it it doesn't make sense to add more and more 'retro' encodings, just for fun ;-) Thanks for your report!
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- resolution changed to: "Invalid"
- status changed to: "Closed"
- type changed to: "Bug"
Ticket change [033061b80e] (rid 196621) by gingerbeardman on 2021-11-17 10:34:59:
- closedate changed to: "2459535.94097194"
- closer changed to: "gingerbeardman"
- icomment:
In that case please leave the new Japanese encoding, i'm intrigued how it differs from macJapan and I'll do some testing as soon as I figure out how to get Tcl source with that change (I can build it, no problem). Thanks!
- login: "gingerbeardman"
- mimetype: "text/plain"
- username: "gingerbeardman"
Ticket change [01c0368d82] (rid 196623) by jan.nijtmans on 2021-11-17 11:04:20:
- closedate changed to: "2459535.96134877"
- closer changed to: "jan.nijtmans"
- icomment:
Then, just download the japanese.enc [https://core.tcl-lang.org/tcl/raw/4de648a75fade117861fed92f9af4a1050ebca1fc24eba63d12e4d448ab4be20?at=japanese.enc|here], and drop it in your tcl_library/encodings directory. That should be enough to make the "japanese" encoding work in your environment
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
Ticket change [977400d2b6] (rid 196624) by gingerbeardman on 2021-11-17 22:04:47:
- closedate changed to: "2459536.41999284"
- closer changed to: "gingerbeardman"
- icomment:
You can see how new I am to Tcl: where would I find "tcl_library/encodings" on modern macOS?
- login: "gingerbeardman"
- mimetype: "text/plain"
- username: "gingerbeardman"
Ticket change [31b71e6e63] (rid 196625) by gingerbeardman on 2021-11-17 22:21:59:
- closedate changed to: "2459536.43193372"
- icomment:
I figured it out, i was using macOS system Tcl which seems not able to be modified. So I installed Tcl 8.6 through macports, copied the enc file in and set the shebang of my script to run using this Tcl. Works! Cheers
- login: "gingerbeardman"
- mimetype: "text/plain"
- username: "gingerbeardman"