Bug 39068 - Adopt new core API for encoding on a per file basis
Summary: Adopt new core API for encoding on a per file basis
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 3.0 M8   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 37933
Blocks: 54468
  Show dependency tree
 
Reported: 2003-06-18 10:41 EDT by Philipe Mulet CLA
Modified: 2004-03-25 12:32 EST (History)
2 users (show)

See Also:


Attachments
patch for jdt.core (21.92 KB, patch)
2004-03-05 05:59 EST, Andre Weinand CLA
no flags Details | Diff
patch for core.filebuffers (1.69 KB, patch)
2004-03-05 06:08 EST, Andre Weinand CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Philipe Mulet CLA 2003-06-18 10:41:12 EDT
Build 3.0m1

Core is adding support for encoding on per file basis. JDT/Core need to adapt 
to it for 3.0
Comment 1 Philipe Mulet CLA 2003-09-09 04:49:35 EDT
Planned item is described at:
http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/platform-core-
home/plan_encoding_intro.html
Comment 2 Philipe Mulet CLA 2003-09-09 04:51:33 EDT
Also see Platform bug 37933
Comment 3 Philipe Mulet CLA 2003-11-10 05:02:42 EST
Planned support in platform is described at:
http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/platform-core-
home/plan_encoding_intro.html
Comment 4 Philipe Mulet CLA 2003-11-10 05:09:29 EST
Issues from the proposal:
- we would need to add support for surfacing encoding changes in Java deltas.
- the proposal wouldn't cover for attached sources since these aren't resources.
Comment 5 Philipe Mulet CLA 2003-11-10 05:15:39 EST
Other potential issue on the perf side:
- the proposal still allows some inference to occur (BOM)
Comment 6 Philipe Mulet CLA 2004-02-24 12:08:26 EST
Please check with Andre Weinand who made some experimentations in this area.
Comment 7 Andre Weinand CLA 2004-03-05 05:59:32 EST
Created attachment 8348 [details]
patch for jdt.core

I'll send more information about the patch and how to proceed with the encoding
work in the next hour or so.
Comment 8 Andre Weinand CLA 2004-03-05 06:08:25 EST
Created attachment 8349 [details]
patch for core.filebuffers

This patch redirects the old encoding property of the editor to the new
encoding support in core.resources. With it you can change the encoding of
files in an editor and get the encoding reported back from IFile.getCharset()
etc. This makes it possible to actually try out the patches applied to
jdt.core: create a Java project, create some Java files with different
encodings. They should compile fine.
Comment 9 Frederic Fusier CLA 2004-03-23 06:26:37 EST
Fixed.

Each time we get an IFile, JDT-Core now get its specific encoding using new API 
IFile.getCharset() instead of project or JavaCore CORE_ENCODING option value.
When no IFile is available, then try to get project default charset using 
IContainer.getDefaultCharset().

However, no change was done for batch compiler which, of course, cannot access 
neither IFile nor IContainer information. Also,no change was done when source 
file was accessed through a zip file or an IO file. In these both cases, we 
continue to use resource plugin default encoding as it was done before...

[jdt-core-internal]
Test cases added in a brand new project 'Encoding' and new test class 
org.eclipse.jdt.core.tests.model.EncodingTests
Comment 10 Andre Weinand CLA 2004-03-23 07:26:22 EST
I would like to try your changes.
Where can I find them?
There are not in HEAD.
Comment 11 Philipe Mulet CLA 2004-03-24 10:47:33 EST
Re: comment #9. The batch compiler has an option to specify a default 
encoding "-encoding <encodingName>", and custom per file encoding by suffixing 
the file name with "[<encodingName>]"
Comment 12 Jerome Lanneluc CLA 2004-03-24 11:30:48 EST
File encoding is not used in Buffer.save(IProgressMonitor, boolean) and 
CommitWorkingCopyOperation.executeOperation().

Reopening to fix those.
Comment 13 Jerome Lanneluc CLA 2004-03-24 11:50:07 EST
Entered bug 55930 instead. Closing this one.
Comment 14 Jerome Lanneluc CLA 2004-03-25 12:32:28 EST
Verified in build I200403250800.