Forcing default encoding on all files in Netbeans

A default file encoding for every file in Netbeans is defined at project level — see Project Properties dialog, Sources category. But there’s nothing similar (possible) for particular files without a project. If you’re using Netbeans just as an editor then all files opened from outside any project will be scrambled, because Netbeans is not using UTF-8 encoding by default on all files.

Solution is to open netbeans.conf, find netbeans_default_options= and add -J-Dfile.encoding=UTF8 to the end of this parameter. It means of course that all files without project will be opened in UTF-8.

More information can be found in this forum thread. And here is a corresponding bug report in Bugzilla.

Leave a Reply