Steps to reproduce:
- Create a file with carriage returns in it:
$ python3
>>> f = open("test", "w")
>>> print("A\x0DB\nC\x0DD", file=f)
>>> f.close()
>>> quit()
- Verify the carriage returns hide some of the text in the file:
- Pipe the file's contents through
stcat:
$ cat test | stcat
A_B
C_D
stcat the file directly:
This is probably because Python's "universal newlines" feature is being left enabled. It's difficult to know what to do about this; should we always be stripping carriage returns, or should we sometimes allow them? Sometimes they're used in line endings in network protocols even outside of the context of Windows, and users might want to sanitize files that come from a Windows machine and not expect to have underscores appear at the end of every single line of text.