TYPE, Unicode, installer

May 20, 2008
11,400
99
Syracuse, NY, USA
Is TYPE supposed to recognize Unicode and display it properly? I found this (fragment of a?) batch file in my temp directory, apparently left by the installer.
Code:
t:\> type {1948DD3B-5B8E-48E1-B620-385FB506AAF2}.bat
  e c h o  o f f
d e l  " h : \ T e m p \ d c 6 d 7 5 a d 8 2 2 6 e 2 0 7 0 d 4 8 c 3 1 3 9 4 9
d 1 2 2 0 \ u p d a t e r . i n i "
d e l  " h : \ T e m p \ d c 6 d 7 5 a d 8 2 2 6 e 2 0 7 0 d 4 8 c 3 1 3 9 4 9
d 1 2 2 0 \ u p d a t e r . d a t "
: a g a i n
i f  n o t  e x i s t  " h : \ T e m p \ d c 6 d 7 5 a d 8 2 2 6 e 2 0 7 0 d
4 8 c 3 1 3 9 4 9 d 1 2 2 0 \ u p d a t e r . e x e "  g o t o  e n d
i f  e x i s t  " h : \ T e m p \

It has no BOM. It starts with an '@' which was lost by TYPE. The Unicode isn't handled correctly and the first line is off (compared to the others) by a byte.

That's the whole file. How did it get chopped off? What about the Unicode?
 

rconn

Administrator
Staff member
May 14, 2008
12,345
150
TYPE recognizes Unicode files if (1) they have a BOM, or (2) they have recognizable (by Windows) Unicode sequences (like a Unicode CR/LF), and (3) they're not an odd number of bytes (which cannot be Unicode).

Without seeing the entire physical file, I can't say why it failed the test. And I have no idea what the installer was doing with the file or how/why it was truncated -- that's a question for Microsoft.
 
May 20, 2008
11,400
99
Syracuse, NY, USA
The file was named {1948DD3B-5B8E-48E1-B620-385FB506AAF2}.bat. It, renamed, is attached.
 

Attachments

  • funnyfile.txt
    480 bytes · Views: 69
May 20, 2008
11,400
99
Syracuse, NY, USA
P.S. Also left, in %TEMP=h:\temp, is a directory, "dc6d75ad8226e2070d48c313949d1220" containing

4/24/2012 20:55 11,459 updater.dat
4/23/2012 0:24 524,392 updater.exe
4/24/2012 20:55 227 updater.ini

The same structure, with the same names, timestamped a few hours earlier, exists in the old temp location (in appdata). That batfile is longer, but still incomplete/truncated and not recognized as Unicode by TYPE. It's attached.
 

Attachments

  • {1948DD3B-5B8E-48E1-B620-385FB506AAF2}.bat
    683 bytes · Views: 75
May 20, 2008
11,400
99
Syracuse, NY, USA
It's 683 bytes, so it obviously cannot be a Unicode (UTF-16) file. So TCC doesn't even bother scanning the file for Unicode strings.
So I deleted the old stuff and upgraded to build 63 ... got new leftovers in TEMP. This time the batfile (attached) is 480 bytes. TYPE doesn't show it properly. Why is it there in the first place? Why is it corrupted?
 

Attachments

  • {1948DD3B-5B8E-48E1-B620-385FB506AAF2}.bat
    480 bytes · Views: 83
May 20, 2008
11,400
99
Syracuse, NY, USA
So I deleted the old stuff and upgraded to build 63 ... got new leftovers in TEMP. This time the batfile (attached) is 480 bytes. TYPE doesn't show it properly. Why is it there in the first place? Why is it corrupted?
And TCC silently does nothing when I try to run it.
 
May 20, 2008
11,400
99
Syracuse, NY, USA
As far as I can tell, CMD can't execute a Unicode batfile, even with a BOM. Why in the world would Microsoft create one? Googling turns up no connection between the Windows installer and anything called "updater.ini"
 
May 20, 2008
11,400
99
Syracuse, NY, USA
And upon checking, I find that the same thing happens on XP ... in TEMP, a folder containing updater.dat|.exe|.ini and a truncated Unicode batfile without a BOM that was apparently not executed.
 
Similar threads
Thread starter Title Forum Replies Date
vefatica TYPE goes crazy with no-BOM Unicode file Support 7
vefatica TYPE /X and Unicode files? Support 0
Joe Caverly Using TYPE with non-English text Support 22
vefatica TYPE behaving randomly Support 10
vefatica Garbage from TYPE Support 2
vefatica TYPE resets console tab settings Support 14
Joe Caverly Get a variable type Support 2
Joe Caverly v24 TYPE Re-direction Support 4
J Piping ANSI control sequences through 'type' Support 4
nickles How to? Follow a JUNCTION type directory link Support 9
S International characters - TYPE vs %@LINE function Support 5
thedave WAD Unable to type various characters using Windows 8's onscreen keyboard Support 7
vefatica Fixed TYPE http://... incomplete data Support 40
Phileosophos Documentation TPIPE /string type code confusion Support 4
S WAD %_do_errors does not report errors when loop control variable type is not directory entry Support 1
vefatica TYPE beeping? Support 12
Charles Dye TYPE /P behaves strangely with piped/redirected input Support 0
vefatica LIST and TYPE show UTF8 BOM Support 4
Charles Dye Fixed TYPE /X reports FF for all values >= 80h Support 6
M More SafeChars type issues... Support 4
Charles Dye Strange output, here-doc redirection, TYPE, //UnicodeOutput=Yes Support 6
Roedy MIME type for *.btm ? Support 1
S TYPE command issue Support 12
dcantor LIST /X and TYPE /X give different results Support 20
Juanma Barranquero App Paths of type REG_EXPAND_SZ Support 2
E colorization outside of type Support 7
p.f.moore Documentation tweak for TYPE Support 5
Peter Murschall TEE cannot handle Unicode output Support 2
B Fullwidth Unicode forms display incorrectly Support 5
T @execstr unicode support Support 6
Peter Murschall TPIPE generate unicode on Piping or redirecting Support 3
D Pasting Unicode data has different behavior on TCC and CMD Support 2
Charles Dye TCC smashing Unicode quotes Support 9
Peter Murschall UNICODE mixed with ANSI Code Support 11
Joe Caverly Unicode, Codepage 437, and line characters Support 3
B How to? Convert Unicode to ANSI Support 1
StarliteLemming Fileread fails on Unicode file Support 10
vefatica DO ... /P ... and Unicode? Support 3
vefatica Unicode ... I don't understand Support 1
jadaml Echo unicode characters from UTF-8 Batch files? Support 1
Charles Dye @ASCII vs. @UNICODE Support 5
A How to? Filter history list with unicode chars Support 0
A WAD Limitations on display of unicode punctuation marks Support 11
A Include lists and Unicode Support 1
M How to? How do I read a Unicode file through standard-input? Support 4
M WAD A bit of strangeness related to Unicode-marked file not being Unicode Support 2
M @CHAR and UNICODE Support 4
D LIST command wierdness with empty Unicode file Support 1
B Unicode/dword issue in TCC12 Support 4
J dir failure with some unicode characters Support 6

Similar threads