99

I want to change encoding of file in NetBeans IDE (ver 6.9.1), let's say from ANSII to UTF-8. How can I do that?

EDIT: I will be more precise. I don't want to change the default encoding in NetBeans. I want to only change encoding of the currently edited file.

Dawid Ohia
  • 16,129
  • 24
  • 81
  • 95

8 Answers8

194

Go to etc folder in Netbeans home --> open netbeans.conf file and add on netbeans_default_options following line:

-J-Dfile.encoding=UTF-8

Restart Netbeans and it should be in UTF-8

To check go to help --> about and check System: Windows Vista version 6.0 running on x86; UTF-8; nl_NL (nb)

Sebas
  • 21,192
  • 9
  • 55
  • 109
Danny
  • 1,949
  • 2
  • 11
  • 2
20

In NetBeans model all project files should have the same encoding. The answer is that you can't do that in Netbeans.

If you are working in Netbeans you should consider to convert all files to a single encoding using other tools.

Vladimir
  • 4,782
  • 7
  • 35
  • 56
  • 1
    Thanks. If someone know such a tool, please post it here: http://superuser.com/questions/208948/how-to-find-files-with-given-character-encoding – Dawid Ohia Nov 09 '10 at 14:23
  • 1
    @JohmM2, You can use jEdit to change the file-encoding if you didn't find something else better. You can convert files one by one on demand. I don't know automatic tool currently, especially if you have files of different encoding. You could possibly use iconv command line tool but I not sure that it will do work the best and that its the best tool. – Vladimir Nov 11 '10 at 16:38
  • 1
    For future generations - for changing encoding Notepad++ can be used. Open file, see it's encoding. convert to desired one and save. – miki Nov 18 '16 at 22:38
  • Is there a way to change or convert an entire folder and subfolders of files? – MonneratRJ Apr 30 '19 at 18:50
9

The NetBeans documentation merely states a hierarchy for FileEncodingQuery (FEQ), suggesting that you can set encoding on a per-file basis:

Just for reference, this is the wiki-page regarding project-wide settings:

user569825
  • 2,369
  • 1
  • 25
  • 45
5

On project explorer, right click on the project, Properties -> General -> Encoding. This will allow you to choose the encoding per project.

jcarballo
  • 27,395
  • 3
  • 28
  • 28
  • 4
    I don't know about former versions of NetBeans, but currently (NetBeans IDE 8.1) this is the right solution for me. Only a little difference in the route: Properties -> Sources -> Encoding. This is because I have several projects in different languages and I could set for my projects in Spanish the encoding to ISO-8859-2 and left the rest in UTF-8 which is the recommended encoding for web projects. Thanks a lot jcarballo! – juangalf Aug 02 '16 at 17:43
5

Yes, you can change the encoding of a specific file (or see what it has) with this Encoding Support plugin. With this plugin you will be able to handle the different encodings of your files without problems.

Now it is in version 1.4.0 for NetBeans 8.2 and I use it in Windows 10 several time ago.

The operation is very simple, in the status line you can see the encoding of the open file, and from there you can define its new encoding.

Encoding Support running on Windows 10

Josem
  • 378
  • 7
  • 15
5

There is an old Bugreport concerning this issue.

acnb
  • 51
  • 1
  • 1
  • I know I am necro commenting, but this high-vote post above saved me... What's unbelievable is that I spent years manually configuring encoding for every sub-option in Eclipse when it's 1 line for NB?! –  Oct 16 '14 at 14:52
2

This link answer your question: http://wiki.netbeans.org/FaqI18nProjectEncoding

You can change the sources encoding or runtime encoding.

iberck
  • 2,372
  • 5
  • 31
  • 41
0

Just try to set the Projects Encoding to "UTF-8" and copy the file (which is encoded in iso) in the same Project (and if you dont need the old file just delete it) - now the copied file will be as UTF-8 - maybe this will help you :)