Bug 155015 - Plugin Export build does not respect text encoding from IDE
Summary: Plugin Export build does not respect text encoding from IDE
Status: RESOLVED FIXED
Alias: None
Product: PDE
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal with 2 votes (vote)
Target Milestone: 3.6 M7   Edit
Assignee: Darin Wright CLA
QA Contact:
URL:
Whiteboard:
Keywords: bugday
: 81918 133584 176413 240449 261395 284107 (view as bug list)
Depends on: 260997
Blocks:
  Show dependency tree
 
Reported: 2006-08-24 06:28 EDT by Marko Topolnik CLA
Modified: 2010-04-26 12:44 EDT (History)
19 users (show)

See Also:


Attachments
org.eclipse.pde.core.patch (5.58 KB, patch)
2009-01-07 18:06 EST, Chris Aniszczyk CLA
no flags Details | Diff
patch (24.97 KB, patch)
2010-04-21 15:38 EDT, Darin Wright CLA
no flags Details | Diff
updated patch with HEAD (25.46 KB, patch)
2010-04-21 20:44 EDT, Darin Wright CLA
no flags Details | Diff
synch with head (25.24 KB, patch)
2010-04-22 10:00 EDT, Darin Wright CLA
no flags Details | Diff
head keeps changing. (33.05 KB, patch)
2010-04-22 16:40 EDT, Darin Wright CLA
no flags Details | Diff
patch (30.54 KB, patch)
2010-04-23 15:51 EDT, Darin Wright CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Marko Topolnik CLA 2006-08-24 06:28:49 EDT
When exporting a plug-in, it gets compiled through a process separate from the normal build process within the IDE. This build process (PDE.Build) disregards the text encoding used by the .java files and assumes some default setting. Since the correct text encoding of each file is known to the IDE, it should somehow be propagated to the PDE.Build process.

The export can be made to work properly by redundantly specifying the text encoding in the build.properties file of each plugin, for example:

javacDefaultEncoding.. =  UTF-8

This is relatively acceptable in the simplest case when all the files use the same encoding, but anything beyond that would probably cause major problems.
Comment 1 Pascal Rapicault CLA 2006-09-05 14:53:55 EDT
I agree with the statement made by Marko. Moving to PDE UI in order to get the encodings written down in the build.properties.
Comment 2 Brian Bauman CLA 2006-09-05 18:20:08 EDT
What is the default value for pde.build (System.getProperties("file.encoding",...))?  Should we only write the tag if the workspace is set to something other the default value for pde.build?
Comment 3 Wassim Melhem CLA 2006-09-05 21:05:56 EDT
Brian, if no encoding is specified, the default encoding of the VM is used.
Comment 4 Andrew Niefer CLA 2007-10-26 11:10:23 EDT
Note that in addition to the default encoding, encodings can also be set on a per file or per folder basis using something like

javacCustomEncodings.. = src/org/foo[US-ASCII],\
                         src/org/foo/bar.java[ISO-8859-1]
Comment 5 Chris Aniszczyk CLA 2008-07-14 10:08:34 EDT
*** Bug 81918 has been marked as a duplicate of this bug. ***
Comment 6 Chris Aniszczyk CLA 2008-07-14 10:09:31 EDT
*** Bug 240449 has been marked as a duplicate of this bug. ***
Comment 7 Chris Aniszczyk CLA 2008-12-17 12:39:20 EST
I think we should do something about this issue finally.
Comment 8 Jörg von Frantzius CLA 2009-01-06 11:56:13 EST
The ".." at the end of the property didn't work for us. For anybody else trying to workaround, please see http://publib.boulder.ibm.com/infocenter/rsmhelp/v7r0m0/index.jsp?topic=/org.eclipse.pde.doc.user/reference/pde_feature_generating_build.htm for details of this build property.

We had to put 

javacDefaultEncoding.ui.jar = UTF-8

for the library "ui.jar" that constitutes our plugin.
Comment 9 Andrew Niefer CLA 2009-01-06 13:39:25 EST
Yes, the actual format is "javacDefaultEncoding.<library>",  '.' is just the most common library, it represents most bundles that are in jar shape.
Comment 10 Chris Aniszczyk CLA 2009-01-07 18:06:24 EST
Created attachment 121890 [details]
org.eclipse.pde.core.patch

Here's a stab at the problem.

If your system encoding differents from your project specific encoding, we will prompty you with a warning and a quickfix. The only problem with this is that it doesn't help people with encoding that are file specific but I think the major problem we're trying to solve here is project level. I don't think it's common for people to just mark a few files with a special encoding. I could be wrong though.
Comment 11 Chris Aniszczyk CLA 2009-01-07 18:28:53 EST
I made some cosmetic changes but I'm content with this patch.

> 20090107
Comment 12 Chris Aniszczyk CLA 2009-01-07 19:01:45 EST
*** Bug 176413 has been marked as a duplicate of this bug. ***
Comment 13 Chris Aniszczyk CLA 2009-01-07 19:11:15 EST
*** Bug 133584 has been marked as a duplicate of this bug. ***
Comment 14 Miles Parker CLA 2009-01-19 14:56:26 EST
(In reply to comment #10)
> I don't think it's common for people to just mark a few files with a special encoding. I could be
> wrong though.

I think you might be. :) Please see bug 261395 openArchitectureWare discussion. I think a lot of users might want to use UTF for default but need ISO-8859-1 for say oAW. That would require a hopeless amount of configuration fiddling.
Comment 15 XhE CLA 2009-07-31 04:42:08 EDT
*** Bug 284107 has been marked as a duplicate of this bug. ***
Comment 16 XhE CLA 2009-07-31 04:57:14 EDT
I also think that this problem should be investigated further. Also the amount of duplicated bug reports seems to confirm I high interest for a further proceeding fix.

To me it sounds like there are two viable options. Either we should make the pde plugin just honour the workbench file encoding settings or change the way that the JDT plugin is handling file encodings at all as e.g. have it also use a build.properties file the build process.
Comment 17 Darin Wright CLA 2009-07-31 11:08:50 EDT
Re-opening this bug. I don't think it should be marked fixed as the fix appears to have been reverted due to bug 260997.
Comment 18 Kai Toedter CLA 2009-10-20 07:51:53 EDT
it's still in Eclipse 3.5.1
Comment 19 Gunnar Wagenknecht CLA 2010-02-10 06:56:48 EST
I wonder if it would be possible to automatically synchronize both? Right now I set the correct encoding in the IDE. Can't PDE Build just use the information from the ".settings/org.eclipse.core.resources.pref" file if it exists and amend those with the once specified in build.properties?
Comment 20 Darin Wright CLA 2010-02-10 09:05:22 EST
(In reply to comment #19)
> I wonder if it would be possible to automatically synchronize both? Right now I
> set the correct encoding in the IDE. Can't PDE Build just use the information
> from the ".settings/org.eclipse.core.resources.pref" file if it exists and
> amend those with the once specified in build.properties?

Yes (sort of). The plan is to have PDE (IDE) update the build.properties with the correct information such that PDE build can honor it.
Comment 21 Darin Wright CLA 2010-04-21 15:38:34 EDT
Created attachment 165625 [details]
patch

Enhancements to also report issues with custom encodings.
Comment 22 Darin Wright CLA 2010-04-21 20:44:00 EDT
Created attachment 165674 [details]
updated patch with HEAD
Comment 23 Darin Wright CLA 2010-04-22 10:00:50 EDT
Created attachment 165764 [details]
synch with head
Comment 24 Darin Wright CLA 2010-04-22 16:40:00 EDT
Created attachment 165850 [details]
head keeps changing.
Comment 25 Darin Wright CLA 2010-04-23 15:51:25 EDT
Created attachment 165959 [details]
patch

NLS'd & improved messages.
Comment 26 Darin Wright CLA 2010-04-23 15:55:57 EDT
Fixed. Note that JDT needs to fix bug 260997 before custom encodings are specified by any build.properties in the releng build.
Comment 27 Miles Parker CLA 2010-04-26 12:44:34 EDT
*** Bug 261395 has been marked as a duplicate of this bug. ***