Execute the command reset
and your terminal should be restored (reference).
This issue happens generally when dumping binary data to the terminal STDOUT
which when the escape codes received are processed can do anything from change the color of the text, disable echo, even change character set.
The easy way to avoid this is to ensure you do not dump unknown binary data to the terminal, and if you must then convert it to hexadecimal to ensure it doesn't change the terminal settings.