Html 如何使用变音生成 javadoc 文档?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1319489/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to generate javadoc documentation with umlauts?
提问by Kim Stebel
I am trying to generate Java documentation in Eclipse. The source files are UTF-8 encoded and contain some umlauts. The resulting HTML files do not specify an encoding and do not use HTML entities, so the umlauts aren't displayed correctly in any browser.
我正在尝试在 Eclipse 中生成 Java 文档。源文件采用 UTF-8 编码并包含一些变音。生成的 HTML 文件未指定编码且不使用 HTML 实体,因此变音符号在任何浏览器中都无法正确显示。
What can I do to change this?
我能做些什么来改变这种情况?
回答by FeelGood
Modified from Eclipse javadoc in utf-8:
Project -> Generate Javadoc -> Next -> on the last page, in Extra Javadoc optionswrite:
Project -> Generate Javadoc -> Next -> 在最后一页,在Extra Javadoc 选项中写:
-encoding UTF-8 -charset UTF-8 -docencoding UTF-8
回答by robinr
See the -charset, -encodingand -docencodingflags for the javadoc command.
见-charset,-编码和-docencoding标志的javadoc的命令。
-encoding
specifies the input encoding-docencoding
specifies the output encoding-charset
makes javadoc include a meta tag with encoding info
-encoding
指定输入编码-docencoding
指定输出编码-charset
使 javadoc 包含一个带有编码信息的元标记
回答by Heiner
If you generate your javadoc with an ant task and you use UTF-8 you can do:
如果您使用 ant 任务生成 javadoc 并且使用 UTF-8,则可以执行以下操作:
<javadoc encoding="UTF-8" charset="UTF-8" docencoding="UTF-8" sourcepath="yoursources" destdir="yourdocdir" />
回答by xtian
When generating the javadoc with Gradle add the following to your build.gradle file:
使用 Gradle 生成 javadoc 时,将以下内容添加到 build.gradle 文件中:
javadoc {
options.encoding = 'UTF-8'
options.docEncoding = 'UTF-8'
options.charSet = 'UTF-8'
}