I know that I should open a binary file using \"rb\" instead of \"r\" because Windows behaves differently for binary and non-binary files.
\"rb\"
\"r\"
In Windows, text mode will convert the newline \n to a carriage return followed by a newline \r\n.
\n
\r\n
If you read text in binary mode, there are no problems. If you read binary data in text mode, it will likely be corrupted.