Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 3c1faa6df2a3a693784bd5b8d7c74d19a68aa59b
Ticket: 768852ffffffffffffffffffffffffffffffffff
binary format a* $utf8_string - needs u/U
User & Date: samoc on 2003-07-11 08:46:49
Changes

  1. icomment:
    Logged In: YES 
    user_id=737265
    
    The manual page says "a: Stores a character string..." and it says
    "If count is *, then all of the bytes in arg will be formatted."
    In Tcl strings are UTF-8, if all the bytes are going to be formatted, 
    then they all need to end up in the result string, without any 
    conversion happening.
    I think the UTF-8 string should be copied verbatim into the "binary 
    format" result. This seems like a sensible behaviour since it 
    preserves the current behaviour for plain ascii strings.
    [binary format a* $x] == $x should hold for any value of x.
    
    (I imagine the current behaviour for "a7" would be unpredictable 
    as well given that the man page talks about bytes not characters.)
    
    Sam
    
    P.S. I am the original submitter.
    
    P.P.S. We have worked arround the bug by changing:
        set r  [binary format iia*i $i $j $s $k]
    to
        set r [binary format ii $i $j]
        append r $s
        append r [binary format i $k]
    
    I think that the "a" encoding should either be removed (since it 
    does no formatting anyway) or be changed to behave as described 
    above.
    
    
  2. login: "samoc"
  3. mimetype: "text/plain"
  4. username: "samoc"