Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Very often, on my Mac, when I use the pipe (|) character followed by a space character, an invincible character will be inserted in between.

This is especially annoying when using the terminal, as it makes commands invalid.

If I type the following in iterm2, I often get the following:

ls | cat
zsh: command not found:  cat

If I hit the up-arrow-key to get my previous command, and then remove and reinsert the space between | and cat, the command will work.

When I copy paste the working and non working commands into a file, like this:

non-working: ls | cat
working: ls | cat

and open it in Hex Fiend it shows the following:

non-working: ls | cat
working: ls | cat

I've also experienced the same kind of issue in SublimeText2 using the square brackets ([]) followed by a space. So I don't believe its an issue with iTerm2.

share|improve this question
    
Related to this, is there a way to have Terminal show invisible characters, similar to how text editors show them, e.g. as a gray bullet? –  jelovirt Jan 26 '13 at 18:43

1 Answer 1

up vote 4 down vote accepted

What happens is that you keep pressing with the space bar, which inserts a non-breaking space, known in HTML through the   reference. This non-breaking space is useful in text processing where you want certain words to stick together, like the "OS" and "X" in "OS X".

Obviously, this is a unicode character (00A0), and therefore most of the command-line utilities will fail, such as bash seeing _cat (where _ is the non-breaking space), and Hex Fiend just using a bad representation for it. Some editors on the other hand will just silently strip it out (e.g. this editor right here), while others even have a special representation for it (e.g. TextMate showing a dot instead of the blank space).

There are two solutions:

share|improve this answer
    
This does indeed appear to be the issue. Can't believe I haven't caught this before. I guess a solution would be to remap space combined with the modifier to a regular space character. –  nifty Apr 24 '12 at 8:12
1  

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.