Eclipse Import Project Chinese garbled reason

Source: Internet
Author: User

The reason for Eclipse's garbled behavior is that the Eclipse editor has chosen a variable encoding rule. Generally, the default is UTF-8 or GBK, when a project imported from the outside, if the project encoding and Eclipse settings in different encoding, will produce Chinese garbled problem, which there are several.

If the entire project is encoded in a way that is in conflict with the way eclipse is encoded, all Chinese in the project are garbled, and if the coding of all projects conflicts with the way the Eclipse workspace is encoded, then all the works in Chinese may be garbled. For the Eclipse workspace, Eclipse saves your settings in the workspace settings file and modifies the encoding of a single project so that eclipse will store the encoding in the project's. Setting package.

Therefore, to avoid the Chinese garbled problem has two principles:

(1) Avoid frequent change of working space, the best projects are done from the start in a workspace, and it is best to set up the working space coding method for the most commonly used or company-defined project coding, so that the project will use the coding method of the workspace, to avoid the occurrence of inconsistent coding;

(2) The same type of file to use the same encoding method, can ensure that the same type of files can use a consistent coding settings;

Solve the Chinese garbled problem can have the following setup scheme:

(1) Modify the coding mode of the working space:

Window->preferences->general->workspace->text file Encoding

Select the encoding you want in the others (if you don't enter it directly), and then save it.

(2) To modify the coding method of a single project:

Right-click the project and select the last "Properties" from the pop-up menu

Select Info (the first one) in the menu tree to the left of the Open new window, then locate the Text file encoding on the right, select "Other", and select the encoding you want in the Drop-down box (if it is not entered directly).

(3) Modify the encoding of a class of files:

If you want to set the JS file encoding to UTF-8, you should

Window->general->content Types

Select JavaScript Source file in the content types, select *.js in the File associations column, and then enter UTF-8 in the default encoding column, click Update to save it.

(4) Modify the encoding of a single file: Right-click the file to be modified, select the last "Properties" in the pop-up menu, select Info in the menu tree to the left of the Open new window (that is, the first one), and then locate the Text file encoding on the right-hand side and select "Other , select the encoding you want in the Drop-down box (if you don't enter it directly). Similar to the method of modifying engineering coding methods.

PS: Another garbled problem encountered during the project is due to the font file problem of the operating system, and in some cases, the Chinese fonts used by Eclipse can cause problems that Chinese cannot display if they are damaged. Therefore, if the above settings can not solve the problem, you should consider the problem of the system font files.

Author: csdn Blog tfy1332

More Wonderful content: http://www.bianceng.cnhttp://www.bianceng.cn/Programming/Java/

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.