Nat! bio photo


Senior Mull

Twitter Github Twitch

c2 ac e2 80 a0 gets on my nerves

I pretty often edit something in vi, for example ad hoc shell scripts or small C test code. It's not that I like vi, actually I hate it. But for worse it's the editor on every Unix. Since I do quite a bit of admin stuff on a variety of Unixes, that's the command line editor I am used to.

On OS X, what's in vi's favor is, that it's an editor I can use in the Terminal window. So I am not losing time, grabbing the mouse going to Textedit, fiddling with the rich text settings etc. I used to use DAGGER, but I pretty much forgot all the key sequences. For heavier editing, I save the file and open -e it in TextEdit or in Xcode.

Anyway, the beef I have and it's seems to be something that I didn't run into before so often, is that I hit some keys accidentally (I presume) and vi inserts some unseeable characters. This occurs invariable after a pipe like echo "$foo" | sed 's/x/y/', resulting in a dreaded "sed command not found", although everything looks nice.

When I open the file with Xcode, I can see that the wrong characters are usually \" \" NOT SIGN and DAGGER (UTF8 codes c2 ac e2 80 a0 0a). Sometimes I have also seen one other code that looks like an E (uppercase e glyph) with some garbage on top (possibly LATIN CAPITAL LETTER E WITH DIAERESIS), but maybe not.

On my german keyboard, I enter the pipe by hitting ALT-5. The curious part is, that I can create the NOT SIGN by hitting ALT-SHIFT-1, but that is so far removed, that I cannot be hitting it accidentally that often. I can reproduce the † by hitting ALT-T, which isn't so far from the [5] key, but that character actually shows up in vi, so it's probably another unicode anyway. I don't know how to produce the messed up E.

So I suspect, that the NOT SIGN, DAGGER appear in Xcode because of some characterset conversion assumptions somewhere.

The crazy part is, that I can't willingly input any unseeable garbage character into vi by pressing any key combination around the pipe key, all those characters show up.