News for hackers. Stuff that matters.
Re:Terminal escape sequences in Git commit email field by tambourine_man on Sunday March 28, 2021 @11:52PM (#26617541)
We've tried many times and in many ways, but text is still the main interface for programers (and even for a lot of end user tasks as well).

As long as this interface remains undisputed, "everything is text" is a feature, not a bug. Arguably, one of Unix's greatest.

Re:Terminal escape sequences in Git commit email field by rurban on Monday March 29, 2021 @02:09AM (#26618179)
The feature is "everything is text". The bug is the misunderstanding that "every text is identifiable". That names are garbage in, garbage out. Unix names are far worse than non-unix names in this regard.

Terminal sequences, unicode all violate the identifier rules. There is no u8ident library to sanitize this input or output.

Re:Terminal escape sequences in Git commit email field by bmn__ on Monday March 29, 2021 @04:04AM (#26618752)
> unicode all violate the identifier rules […] library to sanitize this input

Unicode standardises identifier rules. The default identifier as per UAX31-R1 can be checked with a regex:

    perl -E'say "my_identifier" =~ /\A \p{XID_Start} \p{XID_Continue}* \z/x'
I guess that's not what you mean, so an explanation with some details is needed here.
Re:Terminal escape sequences in Git commit email field by rurban on Monday March 29, 2021 @06:53AM (#26619851)
Yes, unicode is fine. What is broken is that nobody cares. Not even perl5 cares about non-identifiable identifiers.

Btw your snippet does not work for identifier validation. There is much more needed to pass the identifier security guidelines.

But here we just need a simple terminal escape sequence stripping library. Unicode is a bit harder. Only Java, rust and me did that.