Where can I specify my javadoc document charset?

让人想犯罪 __ 提交于 2019-12-06 03:37:32

问题


I'm writing javadoc in Polish language and I want to define UTF-8 charset for my javadoc documentation generated by eclipse - how and where can I do that?


回答1:


Right click on your project
Export... > javadoc
In the third panel, write this

-encoding utf8 -docencoding utf8 -charset utf8




回答2:


There are three relevant options for Javadoc:

  • The -encoding option indicates the encoding of the source files. This should be whatever your sources files are actually encoded in (and the compiler should use the same -encoding option). You can encode characters which are not in the character set of this encoding using the \uXXXX convention. (And there are some people which argue you should never use characters outside of US-ASCII in your source code, to make it portable. I think nowadays UTF-8 is fine.)

  • The -docencoding option indicates which encoding to use when writing out the HTML files. Characters which are used in the produced HTML and not in the character set are replaced by their &#...; equivalent.

  • The -charset option indicates what to write in the <META http-equiv="Content-Type" content="text/html; charset=..."> tag in the header of the generated HTML files.

There is virtually never a reason not to use the same value for -docencoding and -charset, and I don't know why there are two different options for them. Using a different value produces either invalid HTML or at least wrong characters.



来源:https://stackoverflow.com/questions/13302881/where-can-i-specify-my-javadoc-document-charset

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