|
2020-12-05
| ||
| 16:46 | • Ticket [6b1c6bb09c] Extended plane character does not encode correctly to UTF-16... artifact: 384dde679c user: anonymous | |
|
2020-11-30
| ||
| 12:21 | • Closed ticket [6b1c6bb09c]. artifact: 1224088776 user: jan.nijtmans | |
| 12:18 | Fix [6b1c6bb09c]: Extended plane character does not encode correctly to UTF-16 with TCL_UTF_MAX==4 A... check-in: ea91d44454 user: jan.nijtmans tags: core-8-branch | |
|
2020-11-28
| ||
| 15:06 | • Ticket [6b1c6bb09c] Extended plane character does not encode correctly to UTF-16... artifact: b9fcb26428 user: anonymous | |
| 15:04 | • Ticket [6b1c6bb09c]: 3 changes artifact: 7f5b199768 user: anonymous | |
| 15:04 | • Ticket [6b1c6bb09c]: 3 changes artifact: ded508c68c user: anonymous | |
| 15:03 | • New ticket [6b1c6bb09c]. artifact: cd08992ed5 user: anonymous | |
Extended plane character does not encode correctly to UTF-16 with TCL_UTF_MAX==4
Closed / Fixed6b1c6bb09c4fc75326b37f5c7dcdaa44c0a7b6a5Created 6 years agoUpdated 6 years ago
Descriptionplain2020-11-28 15:03:46
When I compile Tcl from the core-8-branch (8.7) with configure option
CFLAGS=-DTCL_UTF_MAX=4, the test below fails. Note that this problem
does not occur with the default TCL_UTF_MAX=3.
>>>>>
package require tcltest
namespace import -force ::tcltest::*
# hex s - Format the string S as a hex dump.
proc hex {s} {
lmap ch [split $s ""] {
format "%02X" [scan $ch "%c"]
}
}
#set catFaceCodepoint 0x1F639
set catFaceUtf8 "\xF0\x9F\x98\xB9"
set catFaceUtf16 "\x3D\xD8\x39\xDE"
test encoding-bug-1 {encoding: extended Unicode UTF-16} {
set tclstring [encoding convertfrom utf-8 $catFaceUtf8]
set utf16 [encoding convertto unicode $tclstring]
hex $utf16
} [hex $catFaceUtf16]
<<<<<
Referenced by1
ea91d44454Fix [6b1c6bb09c]: Extended plane character does not encode correctly to UTF-16 with TCL_UTF_MAX==4 Als use more of TIP #587 in encoding.test check-in2020-11-30 12:18:19
anonymous Ticket [6b1c6bb09c]: 3 changes
[History diff]2020-11-28 15:04:17
anonymous Ticket [6b1c6bb09c]: 3 changes
[History diff]2020-11-28 15:04:57
anonymous Ticket [6b1c6bb09c]: 3 changes
[History diff]2020-11-28 15:06:02
jan.nijtmanswiki2020-11-30 12:21:16
Thanks for the report and the test-case: This pointed - indeed - exactly to the problem. Fixed here: [ea91d44454d0a29b].
There was another problem in big-endian encoding conversion: The lower surrogate was output before the higher surrogate, but that's not how surrogates work. Fixed that too!
Thanks!
anonymousplain2020-12-05 16:46:02
Thanks, you fixed it faster than I could check it out ;-) Works fine now. Pleasure.
Log in (anonymous is fine) to add a comment.