So this just happened as I was writing some C code in vim in Ubuntu 16.04's terminal.
Any time I try to enter a right bracket, the terminal window shows me a '7'. In addition, pressing the '7' key enters a down arrow character (a unicode character I think).
fprintf(stdout, "%s\n", argv[17);
Weirdly, pressing Shift-] results in a '}' as expected, and the other number keys show the corresponding number correctly.
Thinking it was an issue in vim, I tried opening the file in emacs and saw the same thing.
And when I tried compiling the file with gcc, the compiler output had the same weird encoding issue.
I tried to ssh to a remote server and the same thing happened, so I'm pretty sure the problem is with how my terminal is presenting characters.
What's going on and how do I fix it?
Edit: Issue resolved thanks to the tip to use the
reset command. Everything works fine after restarting my terminal. I had been working with binary data which seems to be the cause of this problem.
resetlike here? stackoverflow.com/a/121299
resetand everything's back to normal. I had been working with binary data so that seems to be the explanation for why things were changed so randomly as was mentioned in the link.