Reputation: 101
I created a Gradle-Project in Netbeans and tranfered some existing UTF-8-encoded sourcefiles to it (simply by file copying them to the project folder)
The problem: Netbeans Editor and the Gradle-builded jars using a wrong character encoding (Win1252, my system encoding) to display (Netbeans) and compile (Gradle) the files.
How can I avoid that and configure NB/Gradle to use UTF-8?
Upvotes: 5
Views: 1379
Reputation: 91
Using "Encoding Support" plugin from NetBeans Plugin Portal, it is possible to set encoding individually for each file. I have no idea where this setting is saved for the file.
Procedure: When file is opened, a message box may open to notify about wrong encoding. Agree to continue then change encoding on bottom right corner of IDE. File reloads automatically. One needs to repeat procedure for each file in the project and that is annoying.
Used on Apache NetBeans 12.0, plugin 1.7.0, Gradle project type.
Upvotes: 1
Reputation: 101
Solution: I had to set encoding used in Netbeans globally to UTF-8. Added in netbeans.conf "-J-Dfile.encoding=UTF-8" to parameter "netbeans_default_options". That's all.
There is no known way to set used encoding just for the gradle-project.
Upvotes: 5