3 ms·
Trying to remove control codes reminds me of this answer: https://superuser.com/a/1388860 https://superuser.com/a/1388860 and then I shudder and walk away.. th
by zokier 3y ago
Trying to remove control codes reminds me of this answer: https://superuser.com/a/1388860 https://superuser.com/a/1388860
and then I shudder and walk away.. the variety in the answers is alone a thing to wonder
- JdeBP 3y agoThe sad thing is that none of them are right. To do it properly, one effectively has to take the full state machine of a DEC VT-like terminal emulator and stick it into a filter program. Regular expressions in perl/sed/python aren't enough. There are quite a number of things that can be output to real or emulated terminals that none of these collections of regular expressions will strip correctly. And conversely, these regular expressions will wrongly strip things that, whilst odd, will actually work on real/emulated terminals, including C0 characters that take effect in the middle of control sequences.