Community
Participate
Working Groups
Build 3.0m1 Core is adding support for encoding on per file basis. JDT/Core need to adapt to it for 3.0
Planned item is described at: http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/platform-core- home/plan_encoding_intro.html
Also see Platform bug 37933
Planned support in platform is described at: http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/platform-core- home/plan_encoding_intro.html
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.
Other potential issue on the perf side: - the proposal still allows some inference to occur (BOM)
Please check with Andre Weinand who made some experimentations in this area.
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.
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.
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
I would like to try your changes. Where can I find them? There are not in HEAD.
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>]"
File encoding is not used in Buffer.save(IProgressMonitor, boolean) and CommitWorkingCopyOperation.executeOperation(). Reopening to fix those.
Entered bug 55930 instead. Closing this one.
Verified in build I200403250800.