I have a line like this in my python script:
data = sys.stdin.read()
Then I run the script with file redirecting on Windows:
>> python test.py < binary_file
If binary_file contains \x1a (ctrl-Z) that is EOF in Windows, data will only have the string before \x1a. I know this can be fixed with open("...", "rb") for a regular file.
How would I handle this for sys.stdin?
0x1athat causes EOF. The value0x1ais just a normal byte of data, like any other byte of data.0x0d 0x0awill be converted to0x0aonly. That is, carriage-return followed by newline will be converted to newline only ('\r\n'->'\n')\0x1ain the input.