Netbeans garbled Problem

Source: Internet
Author: User
Tags netbeans

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 ")));

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.