Windows 上的 eclipse 是否添加 Control M 字符
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8562564/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Does eclipse on windows add Control M characters
提问by doon
I am trying to determine if Eclipse on Windows add control-M characters. I have not seen any setting for it in Preferences->Text Editors. If I don't see Control M characters using vi -b on Linux, can I conclude that control-M characters are not present when using eclipse on Windows?
我正在尝试确定 Windows 上的 Eclipse 是否添加了 control-M 字符。我在首选项-> 文本编辑器中没有看到它的任何设置。如果在 Linux 上使用 vi -b 看不到 Control M 字符,我是否可以得出在 Windows 上使用 eclipse 时不存在 control-M 字符的结论?
回答by mliebelt
I finally found under Window > Preferences > General > Workspace
the next text file line delimiter preference. Default is the delimiter of the OS you are using Eclipse on, but you can change that.
我终于找到了下Window > Preferences > General > Workspace
一个文本文件的行分隔符首选项。默认是您在其上使用 Eclipse 的操作系统的分隔符,但您可以更改它。
That means that when you now change a file (coming from Linux) under Windows, and you have not changed the default, the line end convention (of the existing file) will be kept (New text file line delimiter
), but if you create a new file, the convention of your current OS (Windows) will be used.
这意味着,当您现在在 Windows 下更改一个文件(来自 Linux),并且您没有更改默认值时,(现有文件的)行结束约定将保留 ( New text file line delimiter
),但是如果您创建一个新文件,将使用您当前操作系统 (Windows) 的约定。
回答by Jinesh Mathew
You can change line delimiters for all existing files for a project by selecting the project and got to File-->Convert Line Delimiters To-->Unix.
您可以通过选择项目并转到 File-->Convert Line Delimiters To-->Unix 来更改项目的所有现有文件的行分隔符。
This will modify line delimiter for all files under the project. This will solve the issue.
这将修改项目下所有文件的行分隔符。这将解决问题。