错误:stray'\302'在程序中 [英] error: stray '\302' in program
问题描述
我在Ubuntu 10.10上使用Code :: Blocks。我已连接Mac键盘,并将键盘设置为瑞士德国Mac。现在每当我写一个等号,后跟一个空格(例如width = 100),我得到错误信息:stray'\302'in program。
I'm using Code::Blocks on Ubuntu 10.10. I have connected a Mac keyboard and set the keyboard settings to "Swiss German Mac". Now whenever I write an equals sign, followed by a space (something like width = 100) I get the error message error: stray '\302' in program.
我知道这个错误意味着在文本文件中有一个非标准字符。
I know this error means that there is a non standard character in the text file.
当我删除空格字符的程序编译就好了。这意味着Code :: Blocks添加了一些特殊的字符。但我不明白为什么会发生这种情况。任何人都有一个想法。
When I delete the space character the program compiles just fine. So that means Code::Blocks adds some sort of special character. But I can't see why this happens. Anybody have an idea.
'\302'代表什么字符?
What character does '\302' stand for?
[UPDATE]
进一步调查这个问题。当我使用组合shift +空格时,我得到这个偏差。现在我知道这不会发生,经常已经。但是它仍然相当恼人,特别是当编写代码...任何人都知道如果有一个方法来关闭这个组合X11?
[UPDATE] I got a little further investigating the problem. I get this stray when I use the combo shift+space. Now that I know it doesn't happen that often anymore. But it's still rather annoying especially when writing code... Anybody know if there is a way to turn off this combo in X11?
[解决]
感谢到无用的答案,我能够解决问题。它实际上是一个功能。 Shift +空格默认创建一个spacenolinebreak。因此,通过使用
[SOLVED] Thanks to Useless's answer, I was able to solve the "issue". It's more of a feature actually. Shift+space created a spacenolinebreak by default. So by changing the xmodmap with
xmodmap -e "keycode 65 = space space space space space space"
此行为已被覆盖,一切正常。
this behavior was overridden and everything works fine now.
谢谢!
推荐答案
因为你确定它是由击中 shift + space
,你可以检查X本身在做什么。首先,从命令行运行 xev
,命中 shift + space
并检查输出。例如,我看到:
Since you're sure it's caused by hitting shift+space
, you can check what X itself is doing by. First, run xev
from the command line, hit shift+space
and check the output. For example, I see:
$ xev
KeyPress event, serial 29, synthetic NO, window 0x2000001,
root 0x3a, subw 0x0, time 4114211795, (-576,-249), root:(414,593),
state 0x0, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyPress event, serial 29, synthetic NO, window 0x2000001,
root 0x3a, subw 0x0, time 4114213059, (-576,-249), root:(414,593),
state 0x1, keycode 65 (keysym 0x20, space), same_screen YES,
XLookupString gives 1 bytes: (20) " "
XmbLookupString gives 1 bytes: (20) " "
XFilterEvent returns: False
...
$ b b
然后,运行 xmodmap -pk
并查找keycode(空格应该是上面的65,但检查你的xev输出)。
如果您看到
Then, run xmodmap -pk
and look up the keycode (space should be 65 as above, but check your xev output).
If you see something like
65 0x0020 (space)
然后X不这样做。另一方面,如果我选择由 shift
修改 的字符键,我看到这样的字符:
Then X isn't doing this. On the other hand, if I pick a character key which is modified by shift
, I see something like this:
58 0x006d (m) 0x004d (M)
如果你有两个或更多的keyyms为你的keycode,X是罪魁祸首。在这种情况下,像 xmodmap -e'keycode 65 space'
应该可以工作。
If you have two or more keysyms for your keycode, X is the culprit. In that case, something like xmodmap -e 'keycode 65 space'
should work.
这篇关于错误:stray'\302'在程序中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!