Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 047fc7e5422c603ede942d15a534646ddbced42d8f6686bde4097516fd33de0b
Ticket: 535705ffffffffffffffffffffffffffffffffff
Tcl interface to stop on encoding errors
User & Date: oehhar on 2021-03-26 08:47:33
Changes

  1. icomment:
    Dear Jan,
    
    thank you for approaching this, that is great !
    
    A common use-case (for me) is to receive utf-8 over a byte channnel and to detect the character limits.
    
    For example, the sender sends: "12Ü" which is the utf-8 byte stream: 65 66 195 132
    
    Lets receive character per charcter:
    
    <verbatim>
    set s [encoding convertto utf-8 12Ü]
    12Ü
    (bin) 19 % encoding convertfrom utf-8 [string index $s 0]
    1
    (bin) 20 % encoding convertfrom utf-8 [string index $s 1]
    2
    (bin) 21 % encoding convertfrom utf-8 [string index $s 2]
    Ã
    (bin) 22 % encoding convertfrom utf-8 [string index $s 3]
    œ
    </verbatim>
    
    If the sequence is incomplete (and thus invalid utf-8), the undecoded character is returned instead of utf-8.
    
    I would appreciate, to have the following properties:
    
       *   no replacement on incomplete characters
       *   the character index of the error is returned, so the issue may be examinated.
    
    Background: [https://wiki.tcl-lang.org/page/Unicode+and+UTF%2D8]
    
    Thank you,
    Harald
    
  2. login: "oehhar"
  3. mimetype: "text/x-fossil-wiki"
  4. username: "oehhar"