Reputation: 988
As title says, I'm using Netbeans 8.0.2, on Windows 7 OS. I saw many different topics about this and tried different solutions, but none really helped.
So characters like [š, ć, đ, ž, È, æ] are displayed as � or squared, depending on the font. Here is what I've tried:
-J-Dfile.encoding=UTF-8
in ../etc/netbeans.conf
When I'm reading file, I'm using following code:
BufferedReader(new InputStreamReader(new FileInputStream(file), "UTF-8"));
or with Charset.forName("UTF-8")
or StandardCharsets.UTF_8
or Charset.forName("ISO8859-2")
nothing helped.
Any one has idea what other problem could be ?
Upvotes: 6
Views: 4154
Reputation: 4477
That's not a Netbeans issue per se, The netbeans FileAPI
can open files in any encoding. When you don't know what encoding to use you can use this plugin to change the encoding dinamically.
Update: you can find the plugin now in the official plugins page as Encodding Support
Upvotes: 3
Reputation: 6460
BufferedReader br = new BufferedReader(new InputStreamReader(
new FileInputStream(file), StandardCharsets.UTF_8
));
To find file encoding use one of encoding detectors: What is the most accurate encoding detector?
Netbeans
[project settings] / source / encoding = UTF-8
Maven:
<project>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>
Upvotes: 2
Reputation: 988
I have found out that this characters [š, ć, đ, ž, È, æ]
are type Eastern European (Windows-1250).
So the correct encoding type is "Windows-1250"
.
Upvotes: 3