Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: cd44f8c9121e3e901039be4fe88b650594f4167f207115257d66c78d8db2e301
Ticket: bd1a60eb9c080fc419473d7fadc6048d5753daa8
convertfrom utf-8 strict mode allows surrogates in input sequence
User & Date: apnadkarni on 2023-02-11 16:32:24
Changes

  1. comment changed to:
    I think the following is a bug as conformant utf-8 streams are explicitly not permitted to have encoded surrogates.
    
    ```
    % proc codepoints {s} {join [lmap c [split $s ""] {
        string cat U+ [format %.6X [scan $c %c]]}]
    }
    % codepoints [encoding convertfrom -strict utf-8 \xed\xa0\x80\xed\xb0\x80]
    U+010000
    ```
    
    Above should generate an exception.
    
    Looking at fixing (in apn-encoding-profile branch for now, but above sample is from core-8-branch).
    
    Tcl9 behaves as expected.
    
    ```
    % codepoints [encoding convertfrom -strict utf-8 \xed\xa0\x80\xed\xb0\x80]
    unexpected byte sequence starting at index 0: '\xED'
    ```
    
  2. login: "apnadkarni"
  3. mimetype: "text/plain"