问题
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