Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: cd08992ed55034bef312f9ac16587c12086be8099108c6ebc71611c38a370983
Ticket: 6b1c6bb09c4fc75326b37f5c7dcdaa44c0a7b6a5
Extended plane character does not encode correctly to UTF-16 with TCL_UTF_MAX==4
User & Date: anonymous on 2020-11-28 15:03:46
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/plain"
  4. comment changed to:
    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 catFaceUtf "\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 $catFaceUtf]
    	set utf16 [encoding convertto unicode $tclstring]
    	hex $utf16
    } [hex $catFaceUtf16]
    <<<<<
    
  5. foundin changed to: "8.7a4 (2020-11-28)"
  6. is_private changed to: "0"
  7. login: "anonymous"
  8. priority changed to: "5 Medium"
  9. private_contact changed to: "11198a4027193b80a694e66a04403b2c879b1f6f"
  10. resolution changed to: "None"
  11. severity changed to: "Minor"
  12. status changed to: "Open"
  13. submitter changed to: "anonymous"
  14. subsystem changed to: "44. UTF-8 Strings"
  15. title changed to:
    Extended plane character does encode correctly to UTF-16 with TCL_UTF_MAX==4
    
  16. type changed to: "Bug"