Change the default encoding of New Eclipse or MyEclipse files

Source: Internet
Author: User
Change the default encoding of new files in Eclipse or MyEclipse-general Linux technology-Linux programming and kernel information. For more information, see the following. Eclipse: Right window of window-preferences-General-ContentType, which can be changed to gbk or UTF-8.

For myEclipse, encoding exists in window-preferences-myEclipse-editors-jsp.

Eclipse and java file encoding settings

If you search for file encoding problems on the Internet, you can get a lot of answers, or even some are known as the ultimate solution, so you may not encounter Encoding Problems. Why should I write this article? Because I work under two platforms, the default encoding is different, so you need to skip it.

Let's take a look at the eclipse settings. If you download eclipse and do nothing, you can start to create a project and code. Everything is okay, however, you may have moved your project to linux for development, because you are getting tired of winxp and fall in love with ubuntu. This is the case. Open eclipse under winxp, click Window --> Preferences, and expand General --> WorkSpace. The Text file encoding on the left is not displayed. The default setting is simplified Chinese encoding (gbk, gb2312), and linux below, is the UTF-8. Now everyone has understood their differences, what are you waiting for, and now start to set all your WorkSpace file encoding to UTF-8, you will have a java file that can be normally displayed at any time without garbled characters.

But you will say that the previous project is already another code, you do not want to modify it, just want to embrace UTF-8 from now on, it is also possible, when you create a new project, to use different encoding and WorkSpace, right-click your project, select Properties, click Resource, see Text file encoding, click Other, select UTF-8, you really need this encoding format, right?

Is that all done? No, maybe jsp is the file you deal with the most, you do not also want all jsp files are UTF-8? Then let's take a look. Or click Window --> Preferences, this time is to expand Web and XML --> JSP Files, see Encoding, hurry to choose UTF-8. If you can, make the settings of your HTML, CSS, and so on all the files into a UTF-8, and you will have a complete UTF-8 solution.

Finally, let's take a look at the effect you set. Create a new JSP file and select any jsp template in step 2. Then look at the generated jsp file, all are UTF-8, now you can rest assured that your files are UTF-8.
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.