I am writing code in various text editors with Finnish keyboard layout. Sometimes I press alt+spacebar accidentally when writing symbols. E.g.

  if(foobar || foobar2) {

... there is a high change I type pipe+pipe+magical alt-spacebar character.

The thing is, this alt+spacebar character is invisible like space, but behaves differently. Mainly it breaks code syntax in various occasions. However, because the character is invisible it is hard to track down.

What is this alt+spacebar character?

Is it possible to disable it so that when you press alt+spacebar it would type in a normal space?


1 Answer 1


optionspace inserts a non-breaking space (NBSP, U+00A0) by default.

What I've done I've set my editor highlight the non-breaking space, so that I see when I accidentally enter it.

You could remap to a normal space by creating ~/Library/KeyBindings/ and saving a property list like this as DefaultKeyBinding.dict:

    "~ " = (insertText:, " ");
  • This doesn't work on Xcode, not sure why Commented Nov 24, 2015 at 14:48
  • probablby needs an application restart. worked for me because I was having issues with eclipse IDE. Commented May 4, 2017 at 19:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .