Skip to content

A way to print arbitrary binary data safely? #659

@shish

Description

@shish

I want to see a sample of the data that's being written to disk, but I don't want to accidentally print some binary junk and kill my terminal with unintended ANSI control characters. I'd love some kind of formatting option like Python's %r where non-text bytes are replaced with \xNN escape codes :)

$ python -c 'print("%r" % open("/dev/urandom").read(16))'
'GtlR\xb2\x03n\x18\xda)\xe9#\x85"\xca\xda'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions