Eclipse编码 [英] Eclipse encoding

查看:103
本文介绍了Eclipse编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过尝试:
Windows>首选项>常规>内容类型设置我的eclipse默认编码,将UTF-8设置为所有内容类型的默认编码。
Windows>首选项>常规>工作区,将文本文件编码设置为其他:UTF-8。

I set my eclipse default encoding by trying: Windows > Preferences > General > Content Types, set UTF-8 as the default encoding for all content types. Windows > Preferences > General > Workspaces, set "Text file encoding" to "Other : UTF-8".

然后我们导入一些项目总是弄乱一些角色:

Then we I import some projects, it always mess up some characters:

                    case 'a':
        case 'e':
        case 'i':
        case 'o':
        case 'u':
        case 'y':
        case '�':
        case '�':
        case '�':
        case '�':
        case '�':
        case '�':
        case '�':
        case '�':
        case '�':
        case '�':
        case '�':
        case '�':
    }

我该怎么办?任何想法?

What should I do? Any ideas?

推荐答案

有两件事可能发生:


  1. 某些项目(甚至文件夹和/或文件)可能具有自己的特定字符集,这可能与整个工作空间级别的字符集首选项不同。您可以右键单击特定文件,然后执行属性 - >资源来检查正在使用的文本文件编码(默认计算或其他)。作为附加信息,该资源特定首选项存储在项目的 ./设置/ org.eclipse.core.resources.prefs 文件中。

  1. Some projects (even folders and/or files) may have their own specific charset which could be different to the whole workspace-level charset preference. You could right-click on the specific file and do Properties -> Resource to check which text file encoding is really being used (Default computed or Other). As additional info, this Resource specific preferences are stored in the ./settings/org.eclipse.core.resources.prefs file of the project.

如果计算的字符集为UTF-8,则您在Java编辑器中查看的文件不是在UTF-8中进行编码。要验证,您可以在十六进制编辑器中检查这些字符,并使用这个有用的 UTF-8表 来比较表中的预期UTF = 8十六进制值和

If the computed charset is UTF-8, the file you are viewing in the Java editor is not really coded in UTF-8. To verify that, you could check those characters in a hexadecimal editor, and use this useful UTF-8 table to compare the expected UTF=8 hex value in the table and the actual value the hex editor shows you it has.

这篇关于Eclipse编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆