错误消息“错误:程序中流浪'\ 302'" [英] Error message "error: stray '\302' in program"
问题描述
我在
I'm using Code::Blocks on Ubuntu 10.10 (Maverick Meerkat). 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: 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. What is the reason?
"\ 302"代表什么字符?
What character does '\302' stand for?
[更新]
我进一步调查了这个问题.当我使用组合 Shift + Space 时,我会迷路.现在,我知道它不再经常发生.但这仍然很烦人,尤其是在编写代码时……是否有办法在X11中关闭此组合?
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 any more. But it's still rather annoying especially when writing code... Is there a way to turn off this combo in X11?
[已解决]
由于无用的回答,我得以解决问题".实际上,它更多是一个功能.Shift +空格默认情况下会创建一个spacenolinebreak.因此,通过使用
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
...
然后,运行 xmodmap -pk
并查找键码(空格应为上述65,但请检查xev输出).
Then, run xmodmap -pk
and look up the keycode (space should be 65 as above, but check your xev output).
如果看到类似的东西
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)
如果您的键码有两个或多个键符号,则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.
这篇关于错误消息“错误:程序中流浪'\ 302'"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!