It Ninja Turtles eclipse file transcoding plugin

Source: Internet
Author: User

Plug-in source code download (import plugin in workspace, right-export->plug-in development->deployable plug-ins and fragments, then generate plug-in Binar file)
Binary Package Download (since Blogjava does not allow uploading of jar files, download the zip suffix to the jar suffix and then copy it to the Eclipse/plugins directory.)


There are two common ways to use the eclipse processfile Encoding (charset)The situation makes us unhappy.

1 Import a project.
Suppose your colleague has done a project, in order to better support internationalization, the JSP page inside the UTF-8, and then send you, you import into Eclipse workspace, in general, in Eclipse, these JSP all become GBK encoding, you double-click Open, A bunch of garbled characters. Let's say you know why, a little bit of the following can solve the problem:


(Figure 1 Setting the file encoding)
However, this project may contain 1000 JSP files, and you may encounter this problem over and over again, which is really a physical activity.

2 Changing the encoding of a project file
This happens less, but it happens to be a big problem. For example, the company has two teams, one development of the project JSP using UTF-8 encoding, the other one using GBK encoding. After a while, two projects need to be consolidated, and JSP pages can only be coded, UTF-8/GBK, or otherwise. Experienced people know that this is aCopy/Set encoding/pastingThe process of:
2.1 Copy all the contents of a JSP.
2.2 1 shows the encoding set to unified encoding such as UTF-8.
2.3 Empty the encoded JSP file and paste it.
It seems to be a perfect solution, but Eclipse has no macros, and if a lot of files, like 2000, will be a horrible task.

Because these two problems are constantly bothering my colleagues, I believe that also bothered a lot of Java developers, Eclipse transcoding plug-in is very convenient to solve the problem, it is based on Eclipse 3.3 development, so the compilation environment is best to use Eclipse 3.3.

Here are the steps to use

Step1.Copy the plugin Com.lifesting.tool.encoding_1.0.0.jar to the Eclipse/plugins directory and restart Eclipse.

Step2.Select an item, right-select Properties, then click Convert setting for transcoding rules settings, such as:

(Figure 2 Project transcoding rule settings)
This table has four columns, namelyfile suffix,file currently encoded,post-conversion encoding,whether to convert file contents,If you convert the contents of a file, then the second case is the one mentioned above, and the first case is the one that does not convert the contents of the file. Transcoding rules than 2 areJSP files for the project, regardless of the original encoding, unified to UTF-8 encoding, and simultaneously convert the file content. You can add/remove rules by clicking on the Add/remove button on the right. Finally click Apply to save the settings.

Step3. transcoding
on the project that has the transcoding rules set, right-select the project, a few folders or a few files (of course one), and then click Lifesting tools->set Encoding. The plugin will complete the transcoding work. If we select a project, the entire project will be converted, if the folder is selected, all files that satisfy the rule are converted under the folder, and if the file is selected, only the file is converted.

(Fig. 3 transcoding)
In addition to this approach, we can also use Eclipse's file search function to transcode the searched files, such as:

(Figure 4 transcoding in Search view)
as shown, we searched the entire workspace jsp file, and then click on the Green e small icon, the plugin will be all the files that meet the results of transcoding, each file of the conversion rule depends on its own project transcoding rules settings.

It Ninja Turtles eclipse file transcoding plugin

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.