Python和EasyEclipse:相同的代码但结果不同(编码)(Python and EasyEclipse: identical code but results differ (encodin

编程入门 行业动态 更新时间:2024-10-25 12:19:17
Python和EasyEclipse:相同的代码但结果不同(编码)(Python and EasyEclipse: identical code but results differ (encoding))

我无法相信。 在我解决了Eclipse控制台和Python中的编码问题之后,我认为我不会再遇到问题。 但现在这个:

我在项目TestMe中有一个程序test.py,如下所示:

print "ö"

- > Run as... Python Run结果

ö

到现在为止还挺好。 当我现在通过右键单击/复制并粘贴来复制EasyEclipse中的程序时,我会在同一个看起来完全相同的项目中收到test.py的程序副本:

print "ö"

- > Bun Run as... Python Run结果

ö

我注意到,文件属性从编码UTF-8更改为默认,但也更改为UTF-8在这里没有帮助。 这两个文件之间的另一个区别是行结尾,即原始文件中的“Windows”和副本中的“Unix”(复制的明确定义,顺便说一句)。 在Notepad ++中更改此内容也不会改变任何内容。

我很困惑......

设置:Python 2.5 Windows 7 Easy Eclipse 1.2.2.2

我设置为UTF-8 / Windows的设置:项目/右键单击/属性文件/右键单击/属性窗口/首选项/工作区

I can't believe it. After I solved my question in Problems with Encoding in Eclipse Console and Python I thought it wouldn't happen again that I got problems here. But now this:

I have a program test.py in the project TestMe that looks like this:

print "ö"

-> Run as... Python Run results in

ö

So far so good. When I now copy the program in EasyEclipse by right click/copy and paste I receive the program copy of test.py in the same project that looks exactly the same:

print "ö"

-> Bun Run as... Python Run results in

ö

I noticed, that the file properties changed from Encoding UTF-8 to Default, but also changing to UTF-8 doesn't help here. Another difference between the two files is the line ending which is "Windows" in the original file and "Unix" in the copy (great definition of copy, btw). Changing this in Notepad++ also doesn't change anything.

I am perplexed...

Set up: Python 2.5 Windows 7 Easy Eclipse 1.2.2.2

Settings that I've set to UTF-8 / Windows: Project/Rightclick/Properties File/Rightclick/Properties Window/Preferences/Workspace

最满意答案

有几个地方要改变编码,最先沉浸其中:

工作区Window > Preferences > General > Workspace 项目属性 文件属性 运行配置。

使用第一种方法是最有用的方法,因为其他方法包括控制台默认继承它,这可能是你想要的。

Several places to change the encoding, most immersive first:

Workspace Window > Preferences > General > Workspace Project Properties File Properties Run Configuration.

Using the first method is the most useful one as the others including the console inherit from it by default which is probably what you want.

更多推荐

本文发布于:2023-08-04 12:44:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1416457.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:代码   identical   Python   EasyEclipse   differ

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!