malxau / yori

Yori is a CMD replacement shell that supports backquotes, job control, and improves tab completion, file matching, aliases, command history, and more.
http://www.malsmith.net/yori/
MIT License
1.25k stars 31 forks source link

ICONV adds extra line ending to it's output #79

Closed aleaksunder closed 3 years ago

aleaksunder commented 3 years ago

If we try to convert a string with ICONV utility and send it's output to file then the resulting file will contain additional line ending ( CR + LF symbols.

echo -n -- Hello! > C:\temp\file.txt will produce this output in hex:

48 65 6C 6C 6F 21

and

echo -n -- Hello! | iconv -i utf8 -e utf16 > C:\temp\file.txt will produce this output in hex:

48 00 65 00 6C 00 6C 00 6F 00 21 00 0D 00 0A 00

as you can see there is additional 0D 00 0A 00 values in last 4 bytes

aleaksunder commented 3 years ago

Nice! Thanks!