MyEclipse modify file Encoding problem---garbled solution __ Code

Source: Internet
Author: User

It should be the reason for the Chinese operating system, the code for Eclipse's default new project is GBK, and for the sake of coding support, the best unified requirement in the project team is UTF-8 coding for development.

modifying Eclipse configuration allows the default encoding of Eclipse's new project to be directly UTF-8 in the menu bar window->preferences->general->workspace-> Text file encoding change it to UFT-8. This is one of the things that should be done immediately after you install Eclipse . But this modification is only valid for the current workspace, and if you are new or switched to a new workspace, you have to do the same step.

The same window->preferences->general->content types can modify the specific file in different formats of the default encoding, especially the Html,css,javascript file encoding is best to modify, Otherwise, the default iso-8859-1 cannot support Chinese.

After the two steps, the new Java file is UTF-8 encoding, Eclipse compilation, run, Debug is OK, but do rcp application of the product output, or plug-in output, it is always error, or can not compile the pass (the output to be re compile), Or the output of the plug-in run when the Chinese display garbled. At this point need to RCP application, or plug-in plugin engineering build.properties Add a line, javacdefaultencoding ... = UTF-8. UTF-8 encoding when the output is compiled to know the Java source file. This setting requires that all Java source files be UTF-8 encoded and, if not all, referenced in Eclipse Help (Plug-in Development environment Guide > Reference > Feature and Plug-in build configuration), it is recommended that all Java source files be UTF-8 encoded.

If plug-in development, RCP application development originally based on other coding, such as GB18030, want to convert to UTF-8, then first, do the above; then convert the original encoding to UTF-8 encoding by looking up the encoding conversion tool, such as the ICONV based bulk conversion tool, and note that only Java source files are converted. Other types of files may already be a more appropriate encoding, the original project properties of the Text file encoding, from the original code to UTF-8 can be changed.

Do not know how to solve the default installation is GBK problem, must be used in English operating system.

myeclipse6.0 How to unify all file encodings: Windows---->preferences---->myeclipse---->file and editors----->jsp---> Select the encoding in this directory as the encoding you want to set (such as UTF-8) so that the next time you create a new JSP page, you will default to the code you just set up because by default the code for a new JSP page is iso8859-1 and cannot be stored in Chinese. To save Chinese, you have to manually change to Gbk,utf-8 support Chinese encoding, each new to modify the manual to modify the code is very troublesome. After the above settings, you can unify the entire project code without having to manually set it.

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.