How do you set the encoding to utf-8 in NetBeans 6

2019-01-18 02:21发布

问题:

I'm running NetBeans 6.9, can't seem to figure out where to set the encoding. I found some guides on google but all of them were for older versions.

回答1:

The method by Mr. LordofFatality doesn't work for out-of-project files that you open via 'open file' menu.

In order to accomplish that, find a netbeans.conf file in you netbeans installation\etc\, find there a netbeans_default_options line and add there -J-Dfile.encoding=UTF-8 string.

If you don't find the "netbeans_default_options" option there, add a whole new line that should read:

netbeans_default_options="-J-Dfile.encoding=UTF-8"

Relevant to NetBeans 7.2, also works in 7.4

P.S. the problem is present for several years and it's very strange to have such software now. Or I just missed that option, if it's the case, please notify me.

Good luck.



回答2:

In 6.9.1:

  • open the project pane if you don't see it already (Window > Projects);
  • right-click on the name of your project in the tree-view;
  • click properties;
  • make sure the menu item "sources" on the left is highlighted;
  • you should see "Encoding:" and a select-box next to it;
  • click OK. Done.

It SHOULD work that way and does work for anyone on the internet except me. On my Windows XP dev system files are still not saved as UTF-8. Still wondering why ...



回答3:

open the project pane if you don't see it already (Window > Projects) Right-click on the name of your project in the tree-view click properties make sure the menu item "sources" on the left is highlighted you should see "Encoding:" and a select-box next to it. click ok. done.

it SHOULD work that way and does work for anyone on the internet except me. on my windows xp dev system files are still not saved as utf-8. still wondering why...

Your file should content one or more non-latin chars, this is why.



回答4:

its bug always the editor saving my files as utf-8 without bom

See here !!!