Garbled Chinese file names in war files played by ant

Source: Internet
Author: User

If you use the ant script to create war files, if the project contains files with Chinese file names, the names of these files in the war files will become garbled, if you use myeclipse to deploy Tomcat and compress it into war, the same problem also exists.

After checking on the Internet for a long time, I finally found the solution. I added the encoding = "GBK" parameter to the war tag of the ant script and ran the script again. It was really easy to use and there was no garbled code.

Sample script:

<Project name = "XXXX" default = "war" basedir = ".">
<Description> XXXX </description>
 
<Property name = "project. Name" value = "XXXX"/>
<Property name = "Web. Root" value = "webroot"/>

<! -- Create a web archive that can be deployed to an app server -->
<Target name = "war">
<WarEncoding = "GBK"Destfile = "$ {project. name}. War"
Webxml = "$ {web. Root}/WEB-INF/Web. xml"
Basedir = "$ {web. Root}"/>
</Target>
</Project>

 

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.