简体   繁体   English

Ubuntu使用Sublime Text 2的奇怪编码问题

[英]Ubuntu strange encoding issues using sublime text 2

I'm running ubuntu 13.04 64bit, using sublime text 2 writing PHP. 我正在使用编写PHP的Sublime Text 2运行ubuntu 13.04 64bit。 I sometimes seem to get the following error: 我有时似乎收到以下错误:

Parse error: syntax error, unexpected 'Â ' (T_STRING) in
/home/afflicto/public_html/html/HTML.php on line 10

It is solved by removing the entire line and re-writing it. 解决方案是删除整个行并重新编写。 The character is not visible in the source code. 该字符在源代码中不可见。

What's going on? 这是怎么回事? this only happens on ubuntu, never happened on windows. 这仅发生在ubuntu上,从未发生在Windows上。
Thanks in advance. 提前致谢。

What probably is happening is that you are holding alt while pressing space (ALT+space), entering a non-breaking space instead of a regular space. 可能发生的情况是您在按住Alt键的同时按空格键(ALT +空格键),输入一个不间断的空格而不是常规空格。 I'm not 100% sure about Ubuntu, but it's a common problem in OSX. 我对Ubuntu不确定100%,但这是OSX中的常见问题。

To fix it in Sublime Text, add the following to Preferences/Key Bindings - User: 要在Sublime Text中修复它,请将以下内容添加到Preferences / Key Bindings-User:

{ "keys": ["alt+space"], "command": "insert_snippet", "args": {"contents": " " } },

Note that if you have additional lines in the file you need to keep the trailing , - otherwise remove it. 需要注意的是,如果你有在文件中附加行,你需要保持尾随, -否则就删除它。

Read more below: 阅读以下内容:

https://superuser.com/questions/78245/how-to-disable-the-option-space-key-combination-for-non-breaking-spaces https://superuser.com/questions/78245/how-to-disable-the-option-space-key-combination-for-non-breaking-spaces

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM