为什么Netbeans,Aptana Studio和Komodo Edit都不能保存在UTF-8中? [英] Why do Netbeans, Aptana Studio and Komodo Edit all not save in UTF-8?

查看:116
本文介绍了为什么Netbeans,Aptana Studio和Komodo Edit都不能保存在UTF-8中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在重新开发,并希望找到一个适用于HTML5/JQuery的优秀编辑器.

I'm getting back into development and want to find a good editor for HTML5/JQuery.

能够在UTF-8中保存文件很重要.

Being able to save files in UTF-8 is important.

但是,尽管我在 NetBeans 7.0 中设置了我的项目以UTF-8编码,但是当我在项目中创建文件然后在Notepad ++中对其进行查看时,该文件使用ANSI和我必须手动将编码设置为UTF-8:

However, although I set my project in NetBeans 7.0 to encode in UTF-8, when I create a file in the project, then look at it in Notepad++, the file is encoded in ANSI and I have to manually set the encoding to UTF-8:

Aptana Studio 3 中,我将工作区设置为UTF-8编码,并且我的项目继承自该空间,但是当我在项目中创建文件并在Notepad ++中对其进行查看时,该文件已被编码在ANSI中,我必须手动将编码更改为UTF-8:

In Aptana Studio 3 I set the workspace to UTF-8 encoding, and my project inherits from that, but when I create a file in the project and look at it in Notepad++, it is encoded in ANSI and I have to change the encoding manually to UTF-8:

因此,我尝试了 Komodo Edit 7 ,并在文件中手动将编码设置为UTF-8,保存了文件,并在Notepad ++中查看了该文件是否为ANSI.

So I tried Komodo Edit 7 and in the file manually set the encoding to UTF-8, saved the file, looked at it in Notepad++ which said the file is in ANSI.

我在所有这些编辑器中都注意到,如果我在文件中放置了德语变音符号,那么Notepad ++会将其显示为"ANSI as UTF-8",但我仍然必须在Notepad ++中手动将其更改为UTF-8,留下来.

I notice in any of these editors if I put a German umlaut character in the file, then Notepad++ shows it as "ANSI as UTF-8" but I still have to manually change it to UTF-8 in Notepad++ where it will stay.

我想要保存为UTF-8格式的编辑器的原因是,我记得几年前有一个项目,该项目在文件中包含德语和法语字符,并且在使用各种编辑器对其进行查看和保存之后,这些字符将被替换.与垃圾字符.解决方案是始终始终将文件的编码设置为UTF-8.

The reason I want an editor that saves in UTF-8 is I remember having a project a couple years ago which had German and French characters in the files and after they were viewed and saved in various editors, the characters would be replaced with garbage characters. The solution was to always initially set the encoding of the file to UTF-8.

我认为编辑器现在已经发展了很多,如果您指定将文件保存在UTF-8中,则它们实际上以每个现代文本编辑器都可以识别的方式保存在UTF-8中.不是这样吗?关于UTF-8,我对现代文本编辑器和开发环境不了解什么?

I assumed that editors would be so far advanced now that if you specify that the files should be saved in UTF-8, that they actually save in UTF-8 in a way that is recognized by every modern text editor. Is this not the case? What am I not understanding about modern text editors and development environments in regard to UTF-8?

如何让这些编辑器将文件保存为UTF-8编码?

推荐答案

UTF-8编码的文件仅包含ASCII表中也存在的字符(前128个Unicode字符,即您的基本字母数字字符)与ASCII/ANSI编码的文件.我的猜测是Notepad ++根本无法区分(因为没有),并且默认为ANSI.当您包含不在ASCII表中的字符时,您可以看到区别.我只能以"ANSI作为UTF-8来表示"的意思是此文档包含ANSI表(也称为Latin-1)中的字符,并保存在UTF-8中".

A UTF-8 encoded file that only contains characters also present in the ASCII table (the first 128 Unicode characters, i.e. your basic alphanumeric characters) is indistinguishable from an ASCII/ANSI encoded file. My guess is that Notepad++ simply can't make the distinction (because there is none) and defaults to ANSI. You can see the difference when you include a character that is not in the ASCII table. By "ANSI as UTF-8" I can only guess that it means "this documents contains characters from the ANSI table (a.k.a. Latin-1) and is saved in UTF-8".

换句话说,您的IDE可能还不错,问题出在Notepad ++上.

In other words, your IDEs are probably fine, the problem is with Notepad++.

尝试使用像汉字这样的字符,这将导致一个非常独特的UTF-8字节序列,这肯定是不是 ANSI.

Try a character like 漢字, that will result in a pretty unique UTF-8 byte sequence that's most certainly not ANSI.

这篇关于为什么Netbeans,Aptana Studio和Komodo Edit都不能保存在UTF-8中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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