Netbeans Chinese garbled problem summary

Source: Internet
Author: User
Tags glassfish netbeans
Recently, when I started using Netbeans, I encountered the most common Chinese garbled text problem. (It seems that this type of problem needs to be solved from Eclipse, JBuilder, and Netbeans) so I searched online and provided a summary of common Chinese garbled issues. Haha. The most common, source...

 

 

Recently, when I started using Netbeans, I encountered the most common Chinese garbled text problem. (It seems that this type of problem needs to be solved from Eclipse, JBuilder, and Netbeans) so I searched online and provided a summary of common Chinese garbled issues. Haha.

Most commonly, after the source program is imported into Netbeans, the comments or strings are garbled.

This problem cannot be solved. Netbeans allows you to set the file encoding format of the project. Right-click your project, and set the encoding format in Sources in the Properties option. What is better than Eclipse is that there are many encoding formats available here, and the gbk I need is also available. Unlike the several encodings in the drop-down list when Eclipse was used in the past, GBK cannot be found everywhere. Later, I checked it and found out that the ComboBox is not only optional. I can write a GBK myself and then support GBK. Fainting, how is there such a design. The reason for this problem is that the encoding format of your original file is correct, such as GBK, UTF, or others. In short, Netbeans is required. I saw a buddy ask how his file (the same file) contains GBK and Japanese characters. No way, not supported. In addition, if the file has already been opened, the project code will not be automatically refreshed. You need to turn it off and enable it again. I didn't understand it at the beginning.

The problem I encountered was that the content in the file was okay, but after running, the Netbeans console was garbled. You can set the console encoding format in Eclipse, but I cannot find it in Netbeans. The command line parameter-encoding GBK of the program does not work either. Later, I tried various methods and found that there is a Netbeans under The etc directory under the netbeans installation directory. conf with Netbeans startup parameters: netbeans_default_options = "-J-Dcom.sun.aas.installRoot = \" C: \ Program Files \ glassfish-v2ur2 \ "-J-client-J-Xss2m-J-Xms32m-J-XX: permSize = 32 m-J-XX: MaxPermSize = 200 m-J-Xverify: none-J-Dapple.laf.useScreenMenuBar = true-J-Dsun.java2d.noddraw = true ". Add the encoding method setting netbeans_default_options = "-J-Dcom.sun.aas.installRoot = \" C: \ Program Files \ glassfish-v2ur2 \ "-J-client-J-Xss2m-J-Xms32m-J-XX: permSize = 32 m-J-XX: MaxPermSize = 200 m-J-Xverify: none-J-Dapple.laf.useScreenMenuBar = true-J-Dsun.java2d.noddraw = true-J-Dfile.encoding = GBK ", in this way, the Netbeans console can display normal Chinese characters.

Another garbled problem that was most discussed on the internet is that the text in Ubuntu is displayed as a box, because there is no suitable Chinese font file. Solution: Find gbsn00lp. ttf in the/user/share/fonts directory and copy it to javahome/jre/lib/fonts/fallback. Generally, there is no fallback directory in jre. you need to create one. Then open the software such as netbeans that uses the same java environment, and there will be no more interface square problems. Some versions of Ubuntu do not have this font file, the solution is to copy the font in the/usr/share/fonts/truetype/arphic/folder to JAVA_HOME/jre/lib/fonts/fallback.

 

======================================

In windows, I fixed the netbeans 6.0 C/C ++ garbled code process: first, right-click the project and select the encoding. If the original file has been generated, you need to re-enter the Chinese language in all Chinese fields (this may already be garbled. In this way, there will be no garbled characters when looking at the results.

Related Article

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.