35

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?

Ry-
  • 218,210
  • 55
  • 464
  • 476
Kim Stebel
  • 41,826
  • 12
  • 125
  • 142

4 Answers4

57

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
Paŭlo Ebermann
  • 73,284
  • 20
  • 146
  • 210
FeelGood
  • 5,594
  • 2
  • 25
  • 22
38

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
Paŭlo Ebermann
  • 73,284
  • 20
  • 146
  • 210
robinr
  • 4,376
  • 2
  • 20
  • 18
  • Thanks for your answer. I thought there must be some easy way to do this in eclipse, since eclipse already knows the encoding of the input files. – Kim Stebel Aug 24 '09 at 08:24
  • 3
    It is really annoying that there are both `-charset` and `-docencoding` options - I can not imagine a case where these two would be set different (or one would be set and the other one not). – Paŭlo Ebermann Jul 05 '11 at 15:16
2

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" />
Heiner
  • 131
  • 1
  • 8
1

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'
}
xtian
  • 2,908
  • 2
  • 30
  • 43