my question is, how did the output of this binary file change how bash interprets Unicode characters?
Standard Unix terminals support ANSI/VT-100 commands which can control the cursors, the colors, and the fonts. When you type an binary file to the screen, it is likely that some of the binary characters will accidentally match such control codes and set properties of your terminal.
To return your terminal to its default state, run:
reset
Examples of VT-100 control sequences
If you would like the text on your teminal to blink, type:
echo -e '\E[5m'
If you want to switch the display to reverse video, type:
echo -e '\E[7m'
As a more complex example, consider the make
command which can produce a lot of output. To make it easier to spot the important things, you may want to highlight ERR
in reverse video while displaying WARNING
in bold. The following code adds VT-100 controls sequences in to the output of make
to obtain this highlighting on the terminal:
make 2>&1 | sed -e 's/.*\bERR.*/\x1b[7m&\x1b[0m/i' -e 's/.*\bWARN.*/\x1b[1m&\x1b[0m/i'
The above adds control sequences intentionally. When a binary file is typed to the screen, there is no telling what VT-100 control sequences will be accidentally activated.