Artifacts Associated With Ticket 10c2c17c32ab68e6
Ticket change [74030b1761] (rid 208584) by apnadkarni on 2023-02-06 17:01:49:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/x-markdown"
- comment initialized to:
While beefing up test cases for encoders, the following seems suspect to me. ``` % proc codepoints {s} {join [lmap c [split $s ""] { string cat U+ [format %.8X [scan $c %c]]}] } % codepoints [encoding convertfrom utf-32le \x41\x00\x00\x00\x00\xD8\x00\x00\x42\x00\x00\x00] U+00000041 U+000000F0 U+00000042 ``` Where does the U+000000F0 come from? It seems strange that 0x0000D800 gets mapped to that value. Am I missing something? Tcl9 seems fine (maps to U+D800) - foundin initialized to: "8.7"
- is_private initialized to: "0"
- login: "apnadkarni"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- severity initialized to: "Minor"
- status initialized to: "Open"
- submitter initialized to: "apnadkarni"
- subsystem initialized to: "16. Commands A-H"
- title initialized to: "UTF-LE32 encoder mapping of surrogates"
- type initialized to: "Bug"
Ticket change [9d8934b42d] (rid 208585) by apnadkarni on 2023-02-06 17:02:15:
- login: "apnadkarni"
- mimetype: "text/plain"
- severity changed to: "Important"
Ticket change [f264613885] (rid 208588) by jan.nijtmans on 2023-02-06 21:18:25:
- assignee changed to: "jan.nijtmans"
- icomment:
This happens because of the combining behavior of Tcl_UniCharToUtf(), which Tcl 9.0 doesn't do any more by default. Easy to fix. Will do. You will realize that this is invalid UTF-32. When Tcl_UniCharToUtf() receives an upper surrogate, it will output the first byte of the 4-byte UTF-8 encoding (which is 0xF0, in this case). Feeding Tcl_UniCharToUtf() a lower surrogate will complete the remaining 3 bytes. In case of UTF-32, this combining should not be done, but since Tcl_UniCharToUtf() is used for UTF-16 too, that's where the problem comes from. As you already found out, in Tcl 9.0 this is corrected.
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
Ticket change [43348994a9] (rid 208596) by apnadkarni on 2023-02-07 07:38:49:
- icomment:
Yes, I know it is invalid UTF-32. I'm adding tests for handling of invalid byte sequences under different profiles. If errors are not raised, the conversion should be consistent which is what I was checking.
- login: "apnadkarni"
- mimetype: "text/plain"
- icomment:
Ticket change [6cdb9ac9d5] (rid 208610) by jan.nijtmans on 2023-02-07 15:02:10:
- icomment: "Proposed fix [0bb13aadb6e3e553|here]"
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
Ticket change [0642977d2a] (rid 208619) by apnadkarni on 2023-02-08 15:38:29:
- icomment:
With the proposed fix, all current tests pass in my apn-encoding-profile branch. Just FYI
- login: "apnadkarni"
- mimetype: "text/plain"
- icomment:
Ticket change [3624f5267d] (rid 208625) by jan.nijtmans on 2023-02-09 07:57:22:
- icomment:
The bug-fix introduces another (minor) bug. Test-cases added. Still to be fixed.
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- icomment:
Ticket change [72f8cf14bf] (rid 208696) by jan.nijtmans on 2023-02-13 08:40:31:
- closedate changed to: "2459988.86147389"
- closer changed to: "jan.nijtmans"
- icomment:
Fixed [26aadbbd1f1d6290|here] Thanks, Ashok, for the bug-report!
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- resolution changed to: "Fixed"
- status changed to: "Closed"
Ticket change [12b9a533fe] (rid 208700) by jan.nijtmans on 2023-02-13 10:14:47:
- closer changed to: "nobody"
- foundin changed to: "9.0"
- icomment:
After merging the fix to 9.0, it turns out that (new) testcase encoding-16.15 still fails there (it passes in 8.7). So, cannot close this ticket yet, but moving it 8.7 -> 9.0.
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- resolution changed to: "None"
- status changed to: "Open"
Ticket change [b446e51830] (rid 208750) by apnadkarni on 2023-02-15 05:38:31:
- icomment:
I think there is still an issue even with 8.7, not just 9. ``` % codepoints [encoding convertfrom -strict -failindex idx utf-32le \x41\x00\x00\x00\x00\xD8\x00\x00\x42\x00\x00\x00] U+000041 U+00FFFD % set idx 4 ``` idx is correct but the return value has an extra character. This is with checkout [84f30c5d4e] /Ashok
- login: "apnadkarni"
- mimetype: "text/x-markdown"
- icomment:
Ticket change [bcd3cf0427] (rid 208757) by jan.nijtmans on 2023-02-15 07:30:54:
- icomment: "Indeed: [6349e0c2e15e07ab]. Thanks!"
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
Ticket change [e1db249ccd] (rid 208825) by jan.nijtmans on 2023-02-16 21:31:00:
- closedate changed to: "2459992.39653124"
- closer changed to: "jan.nijtmans"
- foundin changed to: "8.7"
- icomment:
Reason for encoding-16.15 failure was in the testcase, not in the code. Fixed now. So, closing.
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- resolution changed to: "Fixed"
- status changed to: "Closed"