1. 程式人生 > >ant編譯報錯“錯誤: 編碼UTF-8的不可映射字符”

ant編譯報錯“錯誤: 編碼UTF-8的不可映射字符”

ant 編譯報錯 error

根據報錯 的提示是編碼的問題,build.xml文件使用的是ANSI,文件中首行使用,網上查資料都是將encoding設置為GBK,設置之後是之前報錯的文件“AdvertiserAction.java”正常了,但是又會產生新的文件“PageUtil.java”報錯“錯誤: 編碼GBK的不可映射字符”,這個錯誤,導致無法修改為GBK格式進行編譯,後來將字符串設置為“iso-8859-1”之後,才可以正常編譯,build.xml文件的內容為:

<target name="compile">

<javac debug="on" srcdir="${src.dir}"

destdir="${build.dir}/${classes.dir}" includeAntRuntime="false" encoding="iso-8859-1"

classpathref="classpath" />


查找過的資料鏈接 https://stackoverflow.com/questions/4995057/unmappable-character-for-encoding-utf-8-error

本文出自 “珊子的木瓜” 博客,請務必保留此出處http://xiaoshanzi.blog.51cto.com/11109496/1977485

ant編譯報錯“錯誤: 編碼UTF-8的不可映射字符”