You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The purpose of Data::Printer is to show people what is in their data, but currently there is no way to see if a string contains [\x01-\x07\x0E-\x1F]. These are not escaped by escape_chars or by print_escapes. This might be my terminal, but I get no output at all from characters like "\x01" so there are essentially invisible to me when using Data::Printer.
I can propose a patch, but I thought I would discuss first. Data::Printer aims to have "sensible defaults", and its purpose is for debugging, so the thing that makes the most sense to me would be to always escape nonprintable characters which have no effect on the rendered output. For example, "\n" doesn't need escaped by default because you can see its effect on a terminal, even though it is technically not a printable character, but "\x7F" and maybe even ones like nonbreaking space "\xA0" and byte-order-mark "\xFEFF" ought to be escaped by default. I know it is definitely helpful to see BOMs as I use the escape_chars = nonascii, but users whose regular text fall into nonascii range probably don't turn that setting on.
It could be added as a new setting escape_chars = nonprintable? (and sure would be nice to have on by default)
Edit well that's not quite right either, because what I want is closer to escape_chars = nonprintable_and_nonascii. And leave escape_chars = nonprintable as an option for people who want to see the nonascii unicode in their output.
escape_chars = nonprintable would sort of make print_escapes obsolete, though, because print_escapes refers only to specific nonprintable control chars. Another option would be to expand print_escapes to include all nonprintable characters.
The text was updated successfully, but these errors were encountered:
The purpose of Data::Printer is to show people what is in their data, but currently there is no way to see if a string contains
[\x01-\x07\x0E-\x1F]
. These are not escaped byescape_chars
or byprint_escapes
. This might be my terminal, but I get no output at all from characters like"\x01"
so there are essentially invisible to me when using Data::Printer.I can propose a patch, but I thought I would discuss first. Data::Printer aims to have "sensible defaults", and its purpose is for debugging, so the thing that makes the most sense to me would be to always escape nonprintable characters which have no effect on the rendered output. For example, "\n" doesn't need escaped by default because you can see its effect on a terminal, even though it is technically not a printable character, but
"\x7F"
and maybe even ones like nonbreaking space"\xA0"
and byte-order-mark"\xFEFF"
ought to be escaped by default. I know it is definitely helpful to see BOMs as I use theescape_chars = nonascii
, but users whose regular text fall into nonascii range probably don't turn that setting on.It could be added as a new setting
escape_chars = nonprintable
? (and sure would be nice to have on by default)Edit well that's not quite right either, because what I want is closer to
escape_chars = nonprintable_and_nonascii
. And leaveescape_chars = nonprintable
as an option for people who want to see the nonascii unicode in their output.escape_chars = nonprintable
would sort of makeprint_escapes
obsolete, though, becauseprint_escapes
refers only to specific nonprintable control chars. Another option would be to expandprint_escapes
to include all nonprintable characters.The text was updated successfully, but these errors were encountered: