I had a problem with the encoding. Not sure if this is due to IDE, but I'm using NetBeans 7.4. I got this piece of code in my J2EE project:
String test = "kukuřičné"; System.out.println(new String(test.getBytes("UTF-8"))); // should display ok System.out.println(new String(test.getBytes("ISO-8859-1"))); System.out.println(new String(test.getBytes("UTF-16"))); System.out.println(new String(test.getBytes("US-ASCII"))); System.out.println(new String(test.getBytes("windows-1250"))); System.out.println(test); // should display ok
And when I run it, it will never be displayed properly. UTF-8 should be able to print is normal, but it is not. Also, when I tried:
System.out.println(Charset.defaultCharset());
He returned windows-1252. The project is set to UTF-8 encoding. I even tried to keep this particular file java in UTF-8, but it still does not display properly.
I tried to create a J2SE project, on the other hand, and when I run the same code, it is displayed correctly. Also, the default encoding is UTF-8 returns.
Both projects set UTF-8 encoding.
I want my J2EE project worked as well as J2SE. I did not notice the problem until the updated my java to version 1.7.0_51-b13, but again, not sure if it is connected.
I am experiencing the same problem as this guy: http://forums.netbeans.org/ptopic37752.html
I also tried to set the default encoding for all IDE: -J-Dfile.encoding = UTF-8, but it did not help.
I noticed an important fact. When I create a new Web application, it is displayed normally. When I create a new Maven web application, it is not displayed correctly.
I found the same problem: https://netbeans.org/bugzilla/show_bug.cgi?id=224526
I still haven't fixed it. still not working solution.
In my pom.xml, the encoding is set correctly, but at the end, window-1252 is still displayed.
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>