Overview
| Artifact ID: | d073b4f13fcd3846a7a2c9e544c86716762c608a6d2e689402d8990b0267f4fd |
|---|---|
| Ticket: | 2bcf781c6c42f23a493a63f3b9fa723ceb184408
Incorrect size computed for some multi-byte UTF-8 characters |
| User & Date: | jan.nijtmans on 2022-03-03 08:08:28 |
Changes
- icomment:
Let's see, in Tcl 8.6: <pre> % string length π¨ 2 % llength [split π¨ {}] 1 % string range π¨ 0 0 ??? % string range π¨ 1 1 ??? % string index π¨ 0 ??? % string index π¨ 1 ??? </pre> In Tcl 8.7: <pre> % string length π¨ 2 % llength [split π¨ {}] 1 % string range π¨ 0 0 π¨ % string range π¨ 1 1 % string index π¨ 0 π¨ % string index π¨ 1 </pre> In Tcl 9.0: <pre> % string length π¨ 1 % llength [split π¨ {}] 1 % string range π¨ 0 0 π¨ % string range π¨ 1 1 % string index π¨ 0 π¨ % string index π¨ 1 </pre> So, length calculations are equal in Tcl 8.6 and 8.7, there isn't - for sure - any bug there. In Tcl 8.7, π¨ cannot be split into surrogates anymore, that's the main differences visible at script level. Where Tcl 8.6 gives nonsence results when trying to split emoji, Tcl 8.7 gives at least consistent results. When Tk crashes because of incorrect length calculations, that's a bug in Tk. In Tk things are more complicated, e.g: <pre> % string length πΆβπ«οΈ 6 </pre> Many emoji consist of multiple Unicode codepoints. When pressing "delete", those all should be deleted. A solution for this in progress, the "glyph_indexing_2" branch. You will find (hopefully) that with Tcl 8.7 (or 9.0) in combination with Tk "glyph_indexing_2", this problem will be gone. So, I think this ticket should move to Tk, and "glyph_indexing_2" is a proposed solution. This branch works fine for the entry widget, there are still known problems with the text widget that still needs to be worked out. Hope this helps - login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"