Community
Participate
Working Groups
Build Identifier: I20110407-2200 Eclipse version:I20110407-2200 OS: Ubuntu Linux 10.10 Java Version: JRE 1.6.0 IBM Linux build pxi3260sr9fp1-20110208_03 (SR9 FP1) Locale: ja_JP.utf8 Reproducible: Always Steps to Reproduce: 1.Import the attached project or create a project with either the class or the method name containing DBCS characters. 2.Click on the project, Project->Generate Javadocs. 3.Go to Window->Preferences->General->Webbrowser and select Use internal web browser radio button and check "Default system web browser". 4. Now click on the class name containing dbcs character in Java editor. 5. Click Navigate->Open Attached Javadoc. 6. The text will be shown all garbled. This could be due to the fact that the Javadoc does not have a meta tag that specifies the document is encoded in UTF-8. The project had encoding set to UTF-8. This bug however has a workaround. If you set your browser to External web browser and choose Firefox, the text will be displayed correctly.
Created attachment 193329 [details] Test project
Can you try this: 1. generate the files into the project 2. try to open the generated HTML directly out of the Package Explorer ==> does that work? Do you know which browser is used as internal browser? Also, please attach the generated files. NOTE: You can set the encoding on the project. When doing so, it's easier for us to import the project.
(In reply to comment #2) > Can you try this: > 1. generate the files into the project > 2. try to open the generated HTML directly out of the Package Explorer > ==> does that work? > > Do you know which browser is used as internal browser? > > Also, please attach the generated files. > > NOTE: You can set the encoding on the project. When doing so, it's easier for > us to import the project. No it does not work that way either. I dont know what browser eclipse is using by default. My best guess is some swt based browser. Please let me stress this fact again, there is no encoding error during javadoc generation. The internal browser is only setting wrong encoding during display. I am 100% sure, this is due to missing encoding tag. If you add following line to the generated html it works fine. <meta http-equiv="content-type" content="text/html; charset=UTF-8"> So I think there is some kind of encoding detection problem.
Created attachment 193453 [details] Project with generated docs
Created attachment 193454 [details] Browser preferences page
We don't control the Javadoc generation -- we just call the javadoc executable. So we can't influence whether the doc gets a meta tag. But we could maybe use Browser#setUrl(String, String, String[]) and set the charset of the enclosing project via the 'headers' parameter.
On my non-UTF-8 Windows system the files display correctly in the internal and external Web browser. I suspect that on your system the encoding of the internal browser is wrong or its auto-detection is not good enough (check context menu > Encoding). This is not a bug of Eclipse. >We don't control the Javadoc generation -- we just call the javadoc executable. >So we can't influence whether the doc gets a meta tag. That's not true: we could pass the project's encoding when generating the Javadoc via -charset option which adds the charset meta data to the HTML files. There were also bugs that the generation failed completely because the source files could not even be read (see e.g. bug 223177). We should pass -encoding and -charset of the project to the javadoc tool.
(In reply to comment #6) > We don't control the Javadoc generation -- we just call the javadoc executable. > So we can't influence whether the doc gets a meta tag. > > But we could maybe use Browser#setUrl(String, String, String[]) and set the > charset of the enclosing project via the 'headers' parameter. This function is working properly under Eclipse 3.6 so this could be a regression bug. These days any modern browser can guess the best possible encoding these days so even without the meta-tag it should be possible to view the DBCS content correctly. I am not sure why the browser is using other encoding despite the default system encoding being UTF-8.
> This function is working properly under Eclipse 3.6 Are you 100% sure? Is it with the same workspace or a different one?
Created attachment 193658 [details] Reference for eclipse 3.6
(In reply to comment #9) > > This function is working properly under Eclipse 3.6 > Are you 100% sure? Is it with the same workspace or a different one? Ya please check the screenshot. However it was under different workspace, the javadoc was produced within that workspace as well. I checked html code there is no metadata mentioning utf-8. The DBCS characters are showing correctly.
> However it was under different workspace, > the javadoc was produced within that workspace as well. I checked html code > there is no metadata mentioning utf-8. The DBCS characters are showing > correctly. But if you take the same workspace with each Eclipse version, is the behavior different?
(In reply to comment #12) > > However it was under different workspace, > > the javadoc was produced within that workspace as well. I checked html code > > there is no metadata mentioning utf-8. The DBCS characters are showing > > correctly. > But if you take the same workspace with each Eclipse version, is the behavior > different? Just confirmed, yes eclipse 3.6 can indeed open the problematic document without any problems. I will include settings too as it seems to be slightly different compared to 4.1. Either way I used default settings.
Created attachment 193659 [details] Eclipse 3.6 Browser preference page
> Either way I used default settings. What do you mean by "settings"? If you try with the identical workspace then no settings should be affected. Also, could you please try with 3.7 (e.g. M6)? Thanks.
(In reply to comment #13) > (In reply to comment #12) > > > However it was under different workspace, > > > the javadoc was produced within that workspace as well. I checked html code > > > there is no metadata mentioning utf-8. The DBCS characters are showing > > > correctly. > > But if you take the same workspace with each Eclipse version, is the behavior > > different? > Just confirmed, yes eclipse 3.6 can indeed open the problematic document > without > any problems. I will include settings too as it seems to be slightly different > compared > to 4.1. Either way I used default settings. Ignore my settings remark, as you can see the setting in both the versions is exactly the same.
(In reply to comment #15) > > Either way I used default settings. > What do you mean by "settings"? If you try with the identical workspace then no > settings should be affected. > > Also, could you please try with 3.7 (e.g. M6)? Thanks. Tried on I20110310-1119 (3.7). Not working either.
OK, I think the reason for the difference you see is that SWT uses WebKitGTK+ since 3.7 M1. I've filed bug 343349 for SWT to investigate this.
Fixing this right is not possible since each project and even each source file can have a different encoding.