0

I do programming with two different Macs, both with an original Apple keyboard and using the German keyboard layout.

There is a strange issue, occurring from time to time. If I enter the squared bracket close ("]"), some other, invisible characters are inserted as well, and e.g. the Python parser does not work on the provided code.

Consider the following two lines of Python code:

def test(self, target, name):
    target[name] = self

and the resulting binary output

$ cat issue.py|xxd
0000000: 6465 6620 7465 7374 2873 656c 662c 2074  def test(self, t
0000010: 6172 6765 742c 206e 616d 6529 3a0a 2020  arget, name):.
0000020: 2020 7461 7267 6574 5b6e 616d 655d c2a0    target[name]..
0000030: 3d20 7365 6c66 0a                        = self.

The string "] =" should be ASCII 0x5D 0x20 0x3D, but instead of a space (0x20), the bytes 0xC2 0xA0 are inserted.

Do you have any idea what the problem might be, and how it could be solved? I have not tampered the OS X keyboard layout in any way, and it does not happen all the time, only about twice a day - but always when typing that special character, "]".

[Edit]

In order to type the "]" character, I need to press Alt + 6, so only 1 meta key is involved. If I hit the wrong one, I would not have produced the right character. Pressing Alt on its own does not produce a character at all, and Alt+ space switches windows, which I would have noticed. So why is no regular space inserted?

  • Does it happen on both Macs? – nohillside May 29 '15 at 7:18
  • 1
    @patrix yes, and it already happened when OS X was still named like cats.. – muffel May 29 '15 at 8:05
  • Fat fingers maybe? I have the same "problem" with the Swiss keyboard sometimes, when I'm too slow with the meta keys (or don't hit the key correctly). – nohillside May 29 '15 at 8:11
  • @patrix I don't know, maybe, I'm a fast typer and may not always be as accurate as I need to be with the meta keys, however I don't know how this could explain the actual behavior. Please see my edit above. – muffel May 29 '15 at 8:20
  • c2 a0 is the utf-8 no break space, normally input via option plus space. – Tom Gewecke May 29 '15 at 12:37

You must log in to answer this question.

Browse other questions tagged .