• 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

Charles Dye

Super Moderator
Staff member
May 20, 2008
3,496
45
Albuquerque, NM
prospero.unm.edu
#1
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.
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
3,496
45
Albuquerque, NM
prospero.unm.edu
#3
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.
 

rconn

Administrator
Staff member
May 14, 2008
10,309
93
#5
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.
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).
 
Top Bottom