Netbeans Chinese garbled problem summary

Source: Internet
Author: User
Tags glassfish netbeans

Address: http://blog.csdn.net/luntan6788/archive/2008/07/14/2651318.aspx

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, SourceProgramAfter being 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 is that the content in the file is okay, but after running, the netbeans console contains garbled characters. 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 encoding method settings 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 ", so that the netbeans console can display normal Chinese.

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.

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.