|
2021-03-10
| ||
| 13:28 | • Closed ticket [0d61d3a2bb]: Tcl interprets two adjacent surrogate code points as... artifact: 7ad5084b00 user: jan.nijtmans | |
|
2021-02-16
| ||
| 12:16 | • Closed ticket [22324bcbdf]: string reverse is broken in 8.6.11 plus 6 other ... artifact: 200150a915 user: jan.nijtmans | |
| 11:11 | Fix [22324bcbd]: string reverse is broken for Emoji. Thanks to Chrisian Werner for bug report and PO... check-in: 6e5efe220f user: jan.nijtmans tags: core-8-6-branch | |
|
2021-02-14
| ||
| 17:26 | • Ticket [22324bcbdf] string reverse is broken in 8.6.11 status still Open wit... artifact: b96745c263 user: jan.nijtmans | |
|
2021-02-13
| ||
| 13:52 | • Ticket [debd088e48] llength split is different from string length status sti... artifact: 88e23725e7 user: sebres | |
| 05:17 | • Add attachment stringrev.diff to ticket [22324bcbdf] artifact: c136d1a304 user: chw | |
| 05:16 | • Ticket [22324bcbdf] string reverse is broken in 8.6.11 status still Open wit... artifact: af2d9ff372 user: chw | |
|
2021-02-12
| ||
| 17:59 | • Ticket [22324bcbdf]: 3 changes artifact: 7d16bca616 user: chw | |
| 17:42 | • Ticket [22324bcbdf]: 5 changes artifact: fa313cc1cc user: jan.nijtmans | |
| 17:28 | • New ticket [22324bcbdf]. artifact: b6ac80a886 user: chw | |
string reverse is broken in 8.6.11
set string \ud83d\udca3 -> 💣 binary encode hex [encoding convertto utf-8 $string] -> f09f92a3 binary encode hex [encoding convertto utf-8 [string reverse $string]] -> edb2a3eda0bd
7ad5084b00Closed ticket [0d61d3a2bb]: Tcl interprets two adjacent surrogate code points as a character encoded using UTF-16 plus 8 other changes ticket2021-03-10 13:28:3288e23725e7Ticket [debd088e48] llength split is different from string length status still Open with 3 other changes ticket2021-02-13 13:52:40
Yep, this is a known bug, since "string reverse" reverses the surrogates resulting in invalid characters. It has been this way since 8.6.0 (most likely 8.5 as well), so it isn't a regression between 8.6.10/8.6.11 (therefore changed "Version" to "8.6". I think 8.7 still has the same bug as well. It's fixed in Tcl 9.0
Some people consider changing the result of existing commands in a patch release (see also [debd088e48]) a bug, so we should be careful when fixing this in 8.6.
Are you willing to supply a patch?
The problem here is that versions < 8.6.11 would result in binary encode hex [encoding convertto utf-8 $string] -> eda0bdedb2a3 i.e. despite being not proper UTF-8 at least the contract of reversing the string is fulfilled, whereas 8.6.11 delivers a questionable result. Yes, I think it should be fixed, but don't know how yet.
The attached stringrev.diff is a POC patch against a core-8-6-11 checkout.
Thanks for the patch! I prefer to fix this in 8.7 first (it's still a bug there too), and after that reconsider for backport to 8.6.
Fixed now in core-8-6-branch and up. Thanks, Christian for the POC patch. There were some corner-cases to be handled, but it was a big help in getting this right!