简体   繁体   English

蚂蚁与IntelliJ IDEA编码问题

[英]Ant with IntelliJ IDEA encoding problems

I'm using IntelliJ IDEA with Ant on Windows 10 to compile & run my project using build.xml 我正在Windows 10上将IntelliJ IDEA与Ant一起使用,以使用build.xml编译和运行我的项目

  • All my files (even build.xml) are coded in UTF-8 我所有的文件(甚至build.xml)都以UTF-8编码

文件是UTF

  • I'm using UTF-8 in XML specification & javac command 我在XML规范和javac命令中使用UTF-8

    <?xml version="1.0" encoding="UTF-8"? > >
    <javac target="1.8" srcdir="${test}" destdir="${build}" encoding="UTF-8" includeantruntime="false" > <javac target="1.8" srcdir="${test}" destdir="${build}" encoding="UTF-8" includeantruntime="false" >

  • I have set UTF-8 as default encoding in IDE 我已将UTF-8设置为IDE中的默认编码

IDE中的默认编码

Still not working. 还是行不通。 It writes diamonds with question marks when there are some diacritics on output. 当输出变音符号时,它会用问号标记钻石。

May it be something related to that I'm making JAR file which is then executed? 可能与我正在制作然后执行的JAR文件有关吗?

The solution is to add jvm argument within build.xml file. 解决方案是在build.xml文件中添加jvm参数。

Example: 例:

<target name="execute" description="Launch an app" depends="jar">
    <java jar="${dist}/${jarname}" dir="${dist}" fork="true">
        <jvmarg value="-Dfile.encoding=UTF-8"/>
    </java>
</target>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM