|
2024-08-25
| ||
| 11:15 | Merge [ab1f0c7834fd0e4b]: Add test cases for [80d4c1c7e5]. check-in: f80e5914e9 user: pooryorick tags: unchained, INCOMPATIBLE_LICENSE | |
| 11:08 | Merge [d7ef8a68d7a2cdb5]: Fix [80d4c1c7e5]: Isolated surrogates are not replaced when encoding to / ... check-in: 70e3598165 user: pooryorick tags: unchained, INCOMPATIBLE_LICENSE | |
|
2024-02-07
| ||
| 08:50 | (cherry-pick): Add test cases for [80d4c1c7e5] check-in: 44cc6f2c62 user: jan.nijtmans tags: core-8-branch | |
| 03:09 | • Closed ticket [80d4c1c7e5]: Isolated surrogates are not replaced when encoding t... artifact: abdf6c0c39 user: apnadkarni | |
| 03:06 | Add test cases for [80d4c1c7e5] check-in: ab1f0c7834 user: apnadkarni tags: trunk, main | |
|
2024-02-06
| ||
| 13:23 | • Pending ticket [80d4c1c7e5]: Isolated surrogates are not replaced when encoding ... artifact: 80a06ba234 user: jan.nijtmans | |
| 13:22 | Fix [80d4c1c7e5]: Isolated surrogates are not replaced when encoding to / from utf-8 check-in: d7ef8a68d7 user: jan.nijtmans tags: trunk, main | |
| 13:22 | • Ticket [80d4c1c7e5] Isolated surrogates are not replaced when encoding to / from... artifact: 5d1deab796 user: jan.nijtmans | |
| 13:15 | • Ticket [80d4c1c7e5]: 3 changes artifact: 6f1c99cea5 user: apnadkarni | |
| 13:03 | • Ticket [80d4c1c7e5]: 4 changes artifact: 763b0c84f0 user: jan.nijtmans | |
| 13:01 | Proposed fix for [80d4c1c7e5]: Isolated surrogates are not replaced when encoding to / from utf-8 closed check-in: c37652549e user: jan.nijtmans tags: bug-80d4c1c7e5 | |
| 12:30 | • Ticket [80d4c1c7e5] Isolated surrogates are not replaced when encoding to / from... artifact: 3339fafbd6 user: jan.nijtmans | |
| 12:18 | • Ticket [80d4c1c7e5]: 3 changes artifact: 2500439b30 user: jan.nijtmans | |
| 11:38 | • New ticket [80d4c1c7e5]. artifact: 4736f5b7db user: apnadkarni | |
Isolated surrogates are not replaced when encoding to / from utf-8
Isolated (unpaired) surrogates should be treated as encoding errors.
Example:
% binary encode hex [encoding convertto -profile strict utf-8 \UD800]
unexpected character at index 0: 'U+00D800'
The above is correct as U+D800 should not appear as an isolated surrogate code point. However the following is not,
% binary encode hex [encoding convertto -profile replace utf-8 \UD800]
eda080
eda080 is the utf-8 for U+D800. The output have been efbfbd (U+FFFD replacement char).
In principle, any time the strict profile raises an error, the replace profile should be substituting the replacement character.
Jan, your thoughts?
f80e5914e9Merge [ab1f0c7834fd0e4b]: Add test cases for [80d4c1c7e5]. check-in2024-08-25 11:15:1670e3598165Merge [d7ef8a68d7a2cdb5]: Fix [80d4c1c7e5]: Isolated surrogates are not replaced when encoding to / from utf-8. check-in2024-08-25 11:08:0944cc6f2c62(cherry-pick): Add test cases for [80d4c1c7e5] check-in2024-02-07 08:50:01ab1f0c7834Add test cases for [80d4c1c7e5] check-in2024-02-07 03:06:05d7ef8a68d7Fix [80d4c1c7e5]: Isolated surrogates are not replaced when encoding to / from utf-8 check-in2024-02-06 13:22:59c37652549eProposed fix for [80d4c1c7e5]: Isolated surrogates are not replaced when encoding to / from utf-8 check-in2024-02-06 13:01:11
It looks like you forgot the "-profile replace" handling here:
https://core.tcl-lang.org/tcl/file?name=generic/tclEncoding.c&ci=f1cef9d6c96f7ce5&ln=2595-2607
Agreed
Hmmmm. I now see the PROFILE_REPLACE handling just above that ...... I don't know why it's not working as expected then.
Proposed fix [here]
In 8.7 it appears to work as expected, but in 9.0 "-profile replace" handling was lacking for this specific case.
Do you want to add a testcase?
Fix seems reasonable. If you commit it, I'll the test cases.
Committed now
Added tests. Closing.