Sounds like a “pester the devs” kind of deal if it’s an open-source project. It’d be a matter of them calling isatty(3) and a few extra if statements.
As for Perl, s/\e\[[0-9;]*[a-z]//gi would be my first attempt to get rid of them. You’ve probably been through all this already though.
Technical waffle:
The aforementioned regex/substitution would also delete malformed things like \e[;;;q, but since the offending supplier of codes is probably only generating valid codes, that shouldn’t matter much. There are also rarer escape sequences that it doesn’t catch, which would be where those better third party tools come in.
Come to think of it, there’d be a regex that detects everything laid out in the control_codes(4) man page (and, importantly, nothing that isn’t). It would be one of those terrifying write-only things like the one that validates the full e-mail address standard, but that only proves that such things are possible.
I’m almost tempted to have a go at creating it. Almost. Maybe another day.
Sounds like a “pester the devs” kind of deal if it’s an open-source project. It’d be a matter of them calling isatty(3) and a few extra if statements.
As for Perl,
s/\e\[[0-9;]*[a-z]//gi
would be my first attempt to get rid of them. You’ve probably been through all this already though.Technical waffle:
The aforementioned regex/substitution would also delete malformed things like \e[;;;q, but since the offending supplier of codes is probably only generating valid codes, that shouldn’t matter much. There are also rarer escape sequences that it doesn’t catch, which would be where those better third party tools come in.
Come to think of it, there’d be a regex that detects everything laid out in the control_codes(4) man page (and, importantly, nothing that isn’t). It would be one of those terrifying write-only things like the one that validates the full e-mail address standard, but that only proves that such things are possible.
I’m almost tempted to have a go at creating it. Almost. Maybe another day.