为什么Eclipse使用Cp1252编码? [英] Why does Eclipse use Cp1252 encoding?

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

问题描述

道歉,如果这是一个非常业余的问题!我知道Eclipse使用Cp1252作为其编码的默认值。

我最近创建了一个使用散列图来转换输入到盲文字母的程序。为此,我不得不将编码方法更改为UTF-8。



我也很少知道,但是我读过的一切表示UTF-8可以代表Unicode中的每个字符,并且有一个更大的识别符号库。



为什么这不是Eclipse的首选编码风格?

解决方案

p>当您针对全新的工作区启动Eclipse时,在处理某些类型的基于文本的文件时,Eclipse必须确定要使用的编码:文本文件,Java源文件,JSP文件,XML等。 / p>

默认情况下,Eclipse使用默认平台编码,这是从您的操作系统的设置派生的。



至于为什么UTF-8不是文本文件的默认编码,原因是在全世界仍然有大量的纯文本文件,UTF-8不会向后退兼容。虽然UTF-8向后兼容大多数西方编码,但对于其他编码则不是这样。



您可以通过修改工作区的设置来更改这些默认编码。记住,这些设置存储在工作空间级别;如果以后启动新工作区,新工作区将设置默认编码。



要更改默认编码,只需转到工作区 - >首选项,然后键入编码在对话框左上角的搜索框中。 Eclipse将过滤首选项对话框以包含与编码相关的项目。


Apologies if this is a very amateurish question! I know Eclipse uses Cp1252 as the default for its encoding.
I recently created a program using hash maps to convert letters input to Braille. To do this, I had to change the encoding method to UTF-8.

I know very little about either, but everything I've read indicates UTF-8 can represent every character in Unicode and has a much bigger library of recognised symbols.

Why then is it not the preferred encoding style for Eclipse?

解决方案

When you start Eclipse against a brand new workspace, Eclipse has to decide which encoding to use, by default, when handling certain types of text-based files: text files, Java source files, JSP files, XML and so forth.

By default, then, Eclipse uses the default platform encoding, which is derived from your operating system's settings.

As to why UTF-8 isn't the default encoding for text files, the reason is that still, throughout the world, there is a significant number of plain text files for which UTF-8 is not backward compatible. While UTF-8 is backward compatible with most western encodings, that is not the case for other encodings.

You can change these default encodings by modifying the workspace's settings. Remember, though, that these settings are stored at the workspace level; if you later start a new workspace, the new workspace will have the default encodings set.

To change the default encodings, just go to Workspace -> Preferences, and type "encoding" in the search box at the top left of the dialog. Eclipse will filter the preferences' dialog to contain items that are relevant for encodings.

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

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