Details
Description
I am a freemarker user from China, my operating system is window10. I execute this command (ant javadoc) in CMD environment, got the following error:
[javadoc] Generating Javadoc
[javadoc] Javadoc execution
[javadoc] Loading source files for package freemarker.cache...
[javadoc] Loading source files for package freemarker.core...
[javadoc] D:\20_Git\OpenSource\freemarker\build\javadoc-sources\freemarker\core\DefaultTruncateBuiltinAlgorithm.java:90: 错误: 编码GBK的不可映射字符
[javadoc] * ellipsis character ({@code "鈥?"}, U+2026), and thus only works with UTF-8, and the cp125x charsets (like
[javadoc] ^
[javadoc] Loading source files for package freemarker.debug...
[javadoc] Loading source files for package freemarker.ext.ant...
[javadoc] Loading source files for package freemarker.ext.beans...
[javadoc] Loading source files for package freemarker.ext.dom...
[javadoc] Loading source files for package freemarker.ext.jdom...
[javadoc] Loading source files for package freemarker.ext.jsp...
[javadoc] Loading source files for package freemarker.ext.jython...
[javadoc] Loading source files for package freemarker.ext.rhino...
[javadoc] Loading source files for package freemarker.ext.servlet...
[javadoc] Loading source files for package freemarker.ext.util...
[javadoc] Loading source files for package freemarker.ext.xml...
[javadoc] Loading source files for package freemarker.log...
[javadoc] Loading source files for package freemarker.template...
[javadoc] Loading source files for package freemarker.template.utility...
[javadoc] 1 error
Then I modify the target _rawjavadoc in build.xml file, add `encoding = "UTF-8"` to the javadoc command to solve the problem
<javadoc
sourcepath="build/javadoc-sources"
destdir="build/api"
doctitle="FreeMarker ${version}"
packagenames="
freemarker.debug, freemarker.template.*,
freemarker.core., freemarker.ext.,
freemarker.cache., freemarker.log."
use="true"
version="true"
author="true"
windowtitle="FreeMarker ${version} API"
classpath="build/classes"
classpathref="ivy.dep"
failonerror="true"
charset="UTF-8"
docencoding="UTF-8"
encoding="UTF-8"
locale="en_US"
>
the Differences in javadoc options:
-charset <charset> Charset for cross-platform viewing of generated documentation.
-encoding <name> Source file encoding name
-docencoding <name> Specify the character encoding for the output