I’m looking for the equivalent of a urlencode for terminal output — I need to make sure that garbage characters I (may) print from an external source don’t end up doing funky things to my terminal, so a prepackaged function to escape special character sequences would be ideal.
I’m working in Python, but anything I can readily translate works too. TIA!
Here’s the same in py3k based on android/cat.c:
Example:
It prints: