Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 5de20983caacee788e8ca76e00b13f1436352876
Ticket: 1165752fffffffffffffffffffffffffffffffff
New encodings: utf-16, utf-16be, utf-16le
User & Date: andygoth on 2005-03-18 04:44:06
Changes

  1. assignee changed to: "dkf"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    The "unicode" encoding provides something like
    utf-16ne, where ne is native endianness.  This isn't
    very useful, and it requires scripts to specially
    process byte arrays (swap byte order, strip/add BOM)
    passing into [encoding convertfrom] and out of
    [encoding convertto].
    
    What's needed are "utf-16", "utf-16be", and "utf-16le"
    encodings.  By all means, keep "unicode" as it is to
    avoid breaking stuff.  But these new encodings will
    more closely adhere with the standards of the same name.
    
    "utf-16" will correctly handle an initial BOM
    (byte-order mark):  If present, it is stripped but
    affects the byte ordering of the rest of the string. 
    If absent, big-endian order is assumed.  If found in
    the middle of the string, it is taken as ZWNBSP
    (zero-width non-breaking space).  And when translating
    to "utf-16", an initial BOM is prepended.
    
    "utf-16le" and "utf-16be" will assume little-endian and
    big-endian byte orderings, respectively, and will treat
    BOMs as ZWNBSPs.
    
    (Or perhaps I have misread the standard.)
    
    I have seen comments to the effect that the BOM should
    never be stripped because it conveys information (the
    byte ordering) that may be useful at the script level.
     But why would the programmer want to know the byte
    ordering of a utf-16 string?  I can't think of a good
    reason.  All I can come up with is, knowing the byte
    order allows the programmer to decode the utf-16 string
    in multiple chunks, only the first of which contains
    BOM.  But this is invalid because the programmer can't
    legally seek to a random byte location and must
    therefore decode everything as a single unit.  So I
    conclude that the BOM is part of the encoding and not
    the payload.
    
  4. foundin changed to: "None"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "andygoth"
  9. subsystem changed to: "16. Commands A-H"
  10. title changed to: "New encodings: utf-16, utf-16be, utf-16le"
  11. type changed to: "RFE"