tomcat源码编译(用maven编译)的乱码问题

本文介绍了在使用maven编译tomcat源码时遇到的乱码问题,原始的build.xml通过Apache Ant进行编译,包含Unicode转码步骤。为了解决maven编译时的相同问题,可以在pom.xml中添加特定配置来实现转码,确保UTF-8编码的正确读写。
摘要由CSDN通过智能技术生成

tomcat源码原本是使用Apache Ant进行编译,其中build.xml中有两行编码格式转换的代码

    <native2ascii src="java" dest="${tomcat.classes}" includes="**/LocalStrings.properties,**/Messages*.properties" encoding="UTF-8"/>
    <native2ascii src="java" dest="${tomcat.i18n}" includes="**/LocalStrings_*.properties" encoding="UTF-8"/>

用于将LocalStringx_*.properties文件进行Unicode转码,本质是代码中用java自带的Properties进行读取,无法正常读写UTF-8编码。

用maven进行编译时也同样需要对应的转码,具体就是在pom.xml中添加如下代码即可:

    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>native2ascii-maven-plugin</artifactId>
        <version>2.0.1</version>
        <executions>
          <execution>
            <id>native2ascii</id>
           
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值