Zend Studio for eclipse - 为项目中的所有文件切换字符编码
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/755245/
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
Zend Studio for eclipse - Switch character encoding for all files in a project
提问by Robin Barnes
I'm using Zend Studio for Eclipise on Mac, and it seems to keep setting all files to have and encoding of 'Mac Roman'. This becomes problematic when I save the files, as they all need to be UTF-8.
我在 Mac 上使用 Zend Studio for Eclipise,它似乎一直将所有文件设置为具有“Mac Roman”的编码。当我保存文件时,这会出现问题,因为它们都需要是 UTF-8。
I know how to change the encoding to UTF-8 on a file by file basis, but I was wondering if I could set this project wide?
我知道如何逐个文件地将编码更改为 UTF-8,但我想知道是否可以将这个项目设置为宽?
回答by SkaveRat
- Eclipse-Wide: Window->Preferences->Appearence->Workspace
- Project-Wide: Rightclick on Project->Properties
- Filewide: Rightclick on File->Properties
- Eclipse-Wide:窗口->首选项->外观->工作区
- 项目范围:右键单击项目-> 属性
- 文件范围:右键单击文件-> 属性
回答by Timm
On my Eclipse for PHP Helios SR 2 for Mac:
在我的 Eclipse for PHP Helios SR 2 for Mac 上:
- Eclipse-Wide: Eclipse->Preferences->General->Workspace
- Eclipse-Wide:Eclipse->Preferences->General->Workspace
The others are the same as @SkaveRat
其他与@SkaveRat 相同
回答by Ehecatl
On a Zend Studio 8.x,for Mac osx 10.5.8 I changed it like this:
在 Zend Studio 8.x 上,对于 Mac osx 10.5.8,我像这样更改了它:
Top menu chose: Edit
->Set encoding
->Other: UTF-8,
. By default it is set Mac Roman.
顶部菜单选择:Edit
-> Set encoding
-> Other: UTF-8,
。默认设置为 Mac Roman。
And then apply.
然后申请。
回答by MGriesbach
Just remember, php does not actually support utf-8 encoded sourcefiles. When creating strings in a utf-8 encoded file, php will just see 2 static bytes per character.
请记住,php 实际上并不支持 utf-8 编码的源文件。在 utf-8 编码文件中创建字符串时,php 只会看到每个字符 2 个静态字节。
Try running the following with either utf-8 or ISO-8859-1 enconding. strlen() will report different lengths depending on encoding.
尝试使用 utf-8 或 ISO-8859-1 编码运行以下命令。strlen() 将根据编码报告不同的长度。
<?php
$string = "?ü?";
echo (strlen($string));
?>