Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2021-01-04
21:45 • Ticket [c376607b22] Tcl 8.6: Extended plane character does not encode correctly ... artifact: aa3226e66f user: anonymous
15:12 • Closed ticket [c376607b22]. artifact: 28098d50cb user: jan.nijtmans
15:06
Fix [c376607b22]: Tcl 8.6: Extended plane character does not encode correctly to UTF-16 with TCL_UTF... check-in: 904ae29e74 user: jan.nijtmans tags: core-8-6-branch
14:22 • New ticket [c376607b22] Tcl 8.6: Extended plane character does not encode correc... artifact: fca0e2affe user: anonymous

Tcl 8.6: Extended plane character does not encode correctly to UTF-16 with TCL_UTF_MAX==5

Closed / Fixedc376607b22fc6e1322d7cbfb8cb664b3ea226fddCreated 6 years agoUpdated 6 years ago
Descriptionplain2021-01-04 14:22:12
Sorry to bother you again about the same problem.  The bug
https://core.tcl-lang.org/tcl/tktview/6b1c6bb09c4fc75326b37f5c7dcdaa44c0a7b6a5
also occurs with Tcl 8.6 (core-8-6-branch), when compiled
with TCL_UTF_MAX==5.  (I had not been aware of this mode
when I reported this bug for 8.7 before.)

To recap, this test fails:

>>>>>
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]
<<<<<

This was fixed in november for 8.7 with
https://core.tcl-lang.org/tcl/info/ea91d44454d0a29b
Referenced by1
  • 904ae29e74Fix [c376607b22]: Tcl 8.6: Extended plane character does not encode correctly to UTF-16 with TCL_UTF_MAX==5 check-in2021-01-04 15:06:34
jan.nijtmanswiki2021-01-04 15:12:29

Fixed now in core-8-6-branch too.

Thanks!

anonymousplain2021-01-04 21:45:43
This works, thanks you very much.
Log in (anonymous is fine) to add a comment.