The strangest error ever in Unix
Not even sure how to explain this but I connect to a remote computer and execute a command which outputs various stuff to stdout for about 10 minutes. (I am basically running some experiments on a tool). After some time during the execution, the English characters that are being output strangely change into characters like below and stay like that even after the execution is finished. Below is me typing echo "what the hell" to the command line followed by the resulting output. This does not happen unless I use ssh. What on earth is going on?
°┤⎽␋⎺┼02% ␊␌␤⎺ "┬␤▒├ ├␤␊ ␤␊┌┌" ┬␤▒├ ├␤␊ ␤␊┌┌ °┤⎽␋⎺┼02%
In general, it's not safe to output arbitrary text that might include binary data to your terminal. It could include terminal escapes and the like.
You can add this to the pipeline to remove everything but printable ascii characters:
somecommand | tr -cd '\11\12\15\40-\176'