How to set the default encoding to UTF-8 in NetBeans
Posted on January 27, 2015
If you have ever opened a file directly using NetBeans and the characters aren’t displaying correctly or you wish to require all files to be opened in UTF-8 to give you best compatibility then please follow the instructions below:
This currently works on all versions tested from 7.0 and up (currently using 8.0.2 at the time of writing).
The steps to achieve this are listed below:
1. Navigate to the “etc” folder inside your NetBeans installation folder, typically that will be as below but could of course differ depending on your setup.
C:\Program Files\NetBeans 8.0.2\etc
2. Open up the file named “netbeans.conf”.
Please note that this will need to be opened will full administrative privileges to allow you to edit.
3. Find the line that starts “netbeans_default_options”
4. Before the last closing quote symbol (“) add in the following line preceded by a space:
5. Save the file, exit NetBeans and restart.
To check if it has worked, either open the file you were having problems with and see if it has fixed it or check manually by navigating to “Help > About” and you should seem something like the following listed (look for the text utf-8):
System: Windows 8 version 6.2 running on amd64; UTF-8; en_GB (nb)