Netbeans garbled Problem
Development Environment:First, it indicates that the IDE is in netbeans 7.0;
Background:In eclipseProgramCopying to netbeans,CodeThe Chinese characters in the zone are garbled. Second, even if the modified Chinese characters are correctly displayed in the program, the garbled characters still appear when the text is output to the plain text file, the output in eclipse is normal.
Cause:Eclipse default code editing encoding is GBK, while netbeans defaults to UTF-8.
Other suggestions:Someone pointed out that if it is in windows, modify the/etc/netbeans. conf under the netbeans installation directory and add (or modify) "-J-Dfile.encoding = GBK" in the variable netbeans_default_options ". You can. However, the actual results are not as expected, and the specific reasons are unknown.
Solution:Right-click the project to be followed by netbeans, right-click the project, and choose "properties"> "Source". In the displayed dialog box, the "encoding" option is available. Even if you modify it in netbeans_default_options, restart the system, it's still UTF-8. Therefore, you only need to modify the encoding format of the project to GBK. This method is feasible.
Appendix:
Of course, if you only need to solve the problem of reading/outputting to plain text display, you only need to encode the output to UTF/GBK;
Code prompt:
Bufferedreader in = new bufferedreader (New inputstreamreader (New fileinputstream (savefilename), "UTF-8 "));
Printwriter out = new printwriter (New bufferedwriter (New outputstreamwriter (New fileoutputstream (savefilename), "GBK ")));