How to generate javadoc documentation with umlauts?

Deadly 提交于 2019-12-20 08:48:36

问题


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.

What can I do to change this?


回答1:


See the -charset, -encoding and -docencoding flags for the javadoc command.

  • -encoding specifies the input encoding
  • -docencoding specifies the output encoding
  • -charset makes javadoc include a meta tag with encoding info



回答2:


Modified from Eclipse javadoc in utf-8:

Project -> Generate Javadoc -> Next -> on the last page, in Extra Javadoc options write:

-encoding UTF-8 -charset UTF-8 -docencoding UTF-8



回答3:


If you generate your javadoc with an ant task and you use UTF-8 you can do:

<javadoc encoding="UTF-8" charset="UTF-8" docencoding="UTF-8" sourcepath="yoursources" destdir="yourdocdir" />



回答4:


When generating the javadoc with Gradle add the following to your build.gradle file:

javadoc {
    options.encoding = 'UTF-8'
    options.docEncoding = 'UTF-8'
    options.charSet = 'UTF-8'
}


来源:https://stackoverflow.com/questions/1319489/how-to-generate-javadoc-documentation-with-umlauts

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!