mfecteau, AWESOME find! I wasn't even aware of the Unicode @comspec '/u' switch (available even on Windows 2000 - who knew?!). Great great find. By the way, all you need to do with your code to get the Unicode data properly (including characters like œ) is one of the following. (Change is for the 'If $unicode_support then' section):
Option 1 - Force a read of the file as Unicode text by opening it in 'UTF16 Little Endian' mode:
If $unicode_support then
dim $command = @ComSpec & " /u /c dir /b " & $s_recurse & "/a" & $s_dir_file_only & " " & $s_hold_split & " > " & @TempDir & "\autoit_mf.tmp"
$i_pid = RunWait($command, "", @SW_HIDE, 4 + 2)
$hFile=FileOpen(@TempDir & "\autoit_mf.tmp",32)
$s_hold_out=FileRead($hFile)
FileClose($hFile)
FileDelete(@TempDir & "\autoit_mf.tmp")
Else
Option 2 - Create the file first using 'UTF16 Little Endian' mode, and change the '>' pipe to '>>' (append):
If $unicode_support then
; create (and clear contents of) tmp file, with Unicode prefix added at start (0xFF+0xFE)
FileClose(FileOpen(@TempDir & "\autoit_mf.tmp",32+2))
; Change pipe from > to >> (append). This will keep Unicode marker (OXFF+0xFE) at start of file intact
dim $command = @ComSpec & " /u /c dir /b " & $s_recurse & "/a" & $s_dir_file_only & " " & $s_hold_split & " >> " & @TempDir & "\autoit_mf.tmp"
$i_pid = RunWait($command, "", @SW_HIDE, 4 + 2)
$s_hold_out=FileRead(@TempDir & "\autoit_mf.tmp") ; Now the contents will be read as Unicode
FileDelete(@TempDir & "\autoit_mf.tmp")
Else
Option 3 - Just do a 'BinaryToString' conversion on the text that was read. (May be slower than the above (?), but it just requires one line to be changed:
; Read file and convert the 'UTF16 Little Endian' data to a Unicode string
$s_hold_out=BinaryToString(FileRead(@TempDir & "\autoit_mf.tmp"),2)
Your modification (with one of the above alterations) now makes the DOS Dir command a viable alternative. Thanks so much for this!
*edit: added option 3