Turn: Eclipse Import Project Chinese garbled problem

Source: Internet
Author: User

The reason that eclipse is garbled is that the encoding rules selected by the Eclipse Editor are mutable. Generally the default is UTF-8 or GBK, when a project imported from the outside, if the project is encoded in the same way as set in eclipse, it will produce garbled Chinese problem, there are several cases.

If the whole project is encoded in a conflict with Eclipse encoding, then all the Chinese in this project is garbled, and if all works are coded in conflict with the way the Eclipse workspace is encoded, then all the Chinese in the project can be garbled. For the Eclipse workspace, eclipse will save your settings in the workspace settings file and modify the encoding for a single project, then eclipse will save the encoding in the project's. setting file package.

Therefore, to avoid Chinese garbled problem has two principles:

(1) Avoid frequent change of working space, the best project from the outset in a working space, and preferably set the working space encoding for your usual or company-mandated project coding method, so that the project will use the work space coding, to avoid inconsistent coding situation;

(2) The same type of files as far as possible using the same encoding method, you can ensure that the same type of files can use consistent encoding settings;

Solve Chinese garbled problem can have the following setup scheme:

(1) Modify the encoding of the workspace:

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

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

(2) Modify the encoding method for individual projects:

Right-click the project and select the last item "Properties" in the popup menu.

Select Info (that is, first) in the menu tree on the left side of the new window that opens, and then find the Text file encoding on the right, select "Other" and select the desired encoding in the dropdown box (if not, enter it 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 the JavaScript Source file in the content types, select *.js in the File associations bar, enter UTF-8 in the default encoding bar, click Update, Save.

(4) To modify the encoding of individual files: Right-click the file you want to modify, select the last Item "Properties" In the popup menu, select Info (i.e. the first one) in the menu tree on the left side of the open new window, and then find the Text file encoding, and select "Other" , select the desired encoding in the drop-down box (if not, enter it directly). Similar to modifying the method of engineering coding.

PS: Another garbled problem encountered during the project is because of the problem with the font file of the operating system, and in some cases, if the Chinese font of the system used by Eclipse is corrupted, it can also cause problems that cannot be displayed in Chinese. Therefore, if the above settings do not solve the problem, you should consider the system font file problems.


Excerpt from Central-perk's column

Turn: Eclipse Import Project Chinese garbled problem

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.