eclipse 无法创建带有外语字符的文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3598117/
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
Unable to create a file with foreign language characters
提问by Joe
I get the following error, when trying to save a properties file (containing name/value pairs) with foreign language characters. How do I set the encoding?
尝试使用外语字符保存属性文件(包含名称/值对)时,出现以下错误。如何设置编码?
Save could not be completed. Some characters cannot be mapped using "Cp1252" character encoding. Either change the encoding or remove the characters which are not supported by the "Cp1252" character encoding.
无法完成保存。某些字符无法使用“Cp1252”字符编码进行映射。更改编码或删除“Cp1252”字符编码不支持的字符。
回答by satya
I presume its eclipse:
我认为它的日食:
- Go to Windows Menu –> Preferences –> General (expand it) –> Workspace (click on it)
- Look for a box “Text File Encoding”. Default will be “Cp1252″.
- Change radio to select other and select “UTF-8″ from combo box.
- 转到 Windows 菜单 –> 首选项 –> 常规(展开它)–> 工作区(单击它)
- 寻找“文本文件编码”框。默认值为“Cp1252”。
- 更改单选以选择其他并从组合框中选择“UTF-8”。
回答by Roland Illig
That looks like Eclipse.
这看起来像 Eclipse。
- Cut the whole contents of the file into the clipboard.
- Save the (now empty) properties file.
- Change the encoding settings of the file (Alt+Enter) to be UTF-8 or whatever you need.
- Paste the clipboard into the editor.
- Save the editor.
- 将文件的全部内容剪切到剪贴板中。
- 保存(现在是空的)属性文件。
- 将文件的编码设置 (Alt+Enter) 更改为 UTF-8 或任何您需要的。
- 将剪贴板粘贴到编辑器中。
- 保存编辑器。
回答by spacewanderer
回答by gaurav_
Best possible solution for this , which I always do .Is to go the respective file in your workspace open it in notepad++ and make the desired changes. Once done , save the file. Your eclipse will ask you to update the code with the changes . Click yes. And you are all good to go now.
对此的最佳解决方案,我总是这样做。是去工作区中的相应文件在记事本++中打开它并进行所需的更改。完成后,保存文件。您的 Eclipse 会要求您使用更改来更新代码。单击是。你们现在都可以走了。
回答by srinath
Fist copy the file and delete that file and then cleat your code in the eclipse after
拳头复制文件并删除该文件,然后在 eclipse 中清除您的代码
create file with same content and rewrite the code it will resolve.
创建具有相同内容的文件并重写它将解析的代码。