Ramblings

<rant>

Subscribe to RSS feed

Posts tagged with "keyboard"

Unrecognized character \xC2

, ,

Ever seen this before? For me with a Norwegian keyboard, I run into it all the time. It happens specially when reaching out for the { } characters, and accidentally still keeping down AltGr when pressing space.

It's a pain in the ass, as AltGr+Space inserts a non-breakable space which is not valid in various programming languages, like perl, but still not visible to the eye.

nicolasm@akiko:~$ perl -wle 'my $a = { };'
Unrecognized character \xC2 in column 10 at -e line 1.
nicolasm@akiko:~$ echo "perl -wle 'my $a = { };'" | hd
00000000  70 65 72 6c 20 2d 77 6c  65 20 27 6d 79 20 20 3d  |perl -wle 'my  =|
00000010  20 7b c2 a0 7d 3b 27 0a                           | {..};'.|
00000018

Notice the c2 a0 combo between the curly brackets!

After ages of annoyance I finally found the solution via: http://lostwebsite.wordpress.com/2008/10/27/annoying-non-breakable-spaces-in-bashzsh/

In Ubuntu you can fix this by going to: Settings -> Keyboard -> Layout -> Alternatives, and select "Using space key to input non-breakable space character" and set it to: "Usual space at any level"

or to quickly fix it:
setxkbmap -option "nbsp:none"
in a shell

For Gnome3 (and Unity?): simply type "region" <Enter> in the command input and choose the same option.

PROFIT!
May 2013
M T W T F S S
April 2013June 2013
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31