Skip to content

Inconsistent handling of carriage returns in stdisplay utilities that read files #28

@ArrayBolt3

Description

@ArrayBolt3

Steps to reproduce:

  1. Create a file with carriage returns in it:
$ python3
>>> f = open("test", "w")
>>> print("A\x0DB\nC\x0DD", file=f)
>>> f.close()
>>> quit()
  1. Verify the carriage returns hide some of the text in the file:
$ cat test
B
D
  1. Pipe the file's contents through stcat:
$ cat test | stcat
A_B
C_D
  1. stcat the file directly:
$ stcat test
A
B
C
D

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions