Ah. Thanks for testing! I didn't even know about the `^Z` behavior. A lot of the
Windows things are fairly foreign to me.
I was testing `WCMD_for()` while failing to recognize that `WCMD_fgets()` may be used by
other things that behave a bit differently.
Your attached patch looks better than my attempt at the fix and solves my problem. Can you
make it in a proper patch so we can supersede this MR? I don't feel like claiming
authorship on this one.
I did some extra testing myself and there's even more weirdness to `FOR /F`... It
handles UTF-16 but only in some cases. When you try to read a UTF-16 file with a BOM it
just stop on the first NUL byte, but if the output comes from a command (via USEBACKQ, one
example would be `wmic`) it seems to handle UTF-16 just fine. So it looks like there's
some conversion happening when shelling out. But that looks like a separate problem.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/352#note_3447