Spring project 奇数中文 一个中文 声明 报错 编码问题 不直接支持 UTF-8

Spring roo project中 异常:

 

Multiple markers at this line
    - The local variable a is never read
    - String literal is not properly closed by a double-
     quote

 

Spring Roo 目前还不直接支持UTF8,只支持西欧字体,用native2ascii转,可以使用maven的plugin了。

下面是配置例子:

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
  <execution>
   <id>compile</id>
   <phase>compile</phase>
   <configuration>
    <tasks>
     <native2ascii
       encoding="UTF-8"
       src="src/main/webapp/WEB-INF/i18n"
       dest="target/${name}-${version}/WEB-INF/i18n"
       includes="*_zh.properties"/>
    </tasks>
   </configuration>
   <goals>
    <goal>run</goal>
   </goals>
  </execution>
</executions>
<dependencies>
  <dependency>
   <groupId>ant</groupId>
   <artifactId>ant-nodeps</artifactId>
   <version>1.6.5</version>
  </dependency>
  <dependency>
   <groupId>com.sun</groupId>
   <artifactId>tools</artifactId>
   <version>1.5.0</version>
   <scope>system</scope>
   <systemPath>${java.home}/../lib/tools.jar</systemPath>
  </dependency>
</dependencies>
</plugin>

 

例如:spring roo project中 :

String hello = "你";

当遇到奇数个汉字的声明的时候会报错误。

 

处理方法如上!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值