by brunosutic · 2y ago · 0 comments
I even made a vim plugin that highlights these "dangerous" characters: https://github.com/vim-utils/vim-troll-stopper
I've never been pranked with unicode characters, but I've had a situation at work where a consultant from Japan unintentionally used some "japanese space" characters in a translation file, and that broke our app. Since I have my vim plugin running all the time it didn't take me a lot to see what's going on.
The em dash doesn’t exist to be aesthetically pleasing, it has a meaning in writing.
https://en.wikipedia.org/wiki/Dash#Em_dash
What you’re seeing is the result of software being more typographically conscious and replacing the incorrect characters we got used to typing in our keyboards with the correct ones. Same reason why " is replaced with “ and ”.
But you’re right that is annoying in a programming environment.
If I type `--` it's because I want `--` (or even `-------` but some software† insists on changing that to a sequence of en-dash), especially I can type them easily on macOS:
- minus key: minus char -
- Option+minus: en dash –
- Option+Shift+minus: em dash —
Similarly, opening and closing single and double quotes are on bracket keys.
† yes there are OS-level settings for that (at least on macOS) but other software do it in addition to the SO, and you can't disable it plus it plays badly with undo.
“ → “
Shift+“ → ”
Option+“ → "I now use Markdown (and store notes on a private server) so commands can readily be replayed.