1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Fixed TYPE /X reports FF for all values >= 80h

Discussion in 'Support' started by Charles Dye, Mar 30, 2012.

  1. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,277
    Likes Received:
    38
    Code:
    @echo off
    setlocal
    
    set bb=%@balloc[256]
    for /l %i in ( 0, 1, 255 ) set rv=%@bpoke[%bb,%i,1,%i]
    
    set filename=testfile.dat
    set handle=%@fileopen[%filename,w,b]
    set rv=%@bwrite[%bb,0,%handle,0,256]
    set rv=%@fileclose[%handle]
    set rv=%@bfree[%bb]
    
    type /x %filename
    del /q %filename
    
    endlocal
    
    TCC v13.04.57 and v12.11.76 both report FF for all values with the top bit set. TCC v11.00.52 works as expected.
     
  2. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,523
    Likes Received:
    4
    Report verified here for all three versions. 32b versions.
    --
    Steve
     
  3. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,277
    Likes Received:
    38
    Another, possibly related, oddity: If the file begins with FFh FEh, then bytes greater than 7Fh are displayed correctly, but the first two are silently dropped: appropriate when dumping a file as UTF-16 text, but not when dumping it as a series of bytes.
     
  4. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,726
    Likes Received:
    80
    Fixed in build 13.04.58. (An unexpectedly demented compiler macro that I'll never use again!)
     
  5. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,726
    Likes Received:
    80
    WAD. Unicode BOMs are always removed (long before) files are read (& displayed in the case of HEAD / TAIL / TYPE). Changing that requires either a complete parser rewrite, or simply removing the /X option from TYPE.

    And TYPE /X does not display a Unicode file as a series of bytes, it displays it as a series of characters (two bytes per character).
     
  6. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,277
    Likes Received:
    38
    How you figure these things out I will never understand. I get confused enough chasing down my own bugs!
     
  7. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,277
    Likes Received:
    38
    Bug squashed in build 59. Thank you, Rex.
     

Share This Page