Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 31a352537cc7b3a58c86f199ece544fbbc4a4ea8
Ticket: 768852ffffffffffffffffffffffffffffffffff
binary format a* $utf8_string - needs u/U
User & Date: samoc on 2003-07-18 07:32:51
Changes

  1. icomment:
    Logged In: YES 
    user_id=737265
    
    It seems to me that there is a simple solution to this problem.
    
    The purpose of binary format is to convert numeric values into
    specified binary representations. "a" and "A" are the only two
    types that don't convert some kind of numeric value. They are
    also uniqie in that they in fact do no conversion at all, they just
    dump a character string into the output.
    Perhaps the reason that no elegant solution presents itself here is
    that character strings have no place in binary format.
    
    I suggest simply depricating "a" and "A". As it stands they are not
    backwards compatible anyway since they don't work with multi-
    byte cahracters, and Tcl is supposed to support these
    transparently.
    If you have code like this
      set foo [binary format iai $x $s $y]
    do this instead:
      set foo [binary format i $x]$s[binary format i $y]
    and if the $s dosn't come out the way you want, use the usual
    encoding commands to deal with it.
    
    If "a" and "A" are to be kept I would suggest that they should
    take the string verbatim in its _current_ encoding. (not the system
    encoding) So if you want somthing else you could do:
      set foo [binary format iai $x [encoding convertto foo $a] $y]
    
    Sam
    
    
  2. login: "samoc"
  3. mimetype: "text/plain"
  4. username: "samoc"