Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 368817 - Projects should always specify encoding
Summary: Projects should always specify encoding
Status: CLOSED DUPLICATE of bug 479450
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Resources (show other bugs)
Version: 4.2   Edit
Hardware: All All
: P3 minor (vote)
Target Milestone: ---   Edit
Assignee: Platform-Resources-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-17 07:03 EST by Olaf Titz CLA
Modified: 2015-10-09 12:04 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Olaf Titz CLA 2012-01-17 07:03:26 EST
Build Identifier: Version: 3.6.1 Build id: M20100909-0800

I'm working with workspaces consisting of (Java) projects from different teams from different original VCS repositories, each of these teams have (historically) different default encodings for their workspaces. Now some parts of my workspace are CP1252, some are UTF-8, and not all of them specify their project encoding in the project (i.e. in .settings/org.eclipse.core.resources.prefs). This makes it very likely that developers get and/or produce corrupted text files.

As is evident in the discussion on bug 108668, there is no single default character encoding which fits all purposes. It makes little sense to default encoding on the platform, as is currently the case, as soon as projects are shared between users. Strictly speaking, the contents of text files in a VCS checked in by a user only relying on workspace default encoding are undefined.

To fix this, it should be mandatory to specify an encoding per project. This can still default to the workspace default, which itself defaults to the platform encoding if not set by the user, but a .settings/org.eclipse.core.resources.prefs file with the encoding/<project>=... line should always be written when creating a project.
This way you can import an arbitrary set of projects into an arbitrary workspace and get the encoding right, always.

(Of course this can be done manually but the platform should do its best to enforce consistency.)

Reproducible: Always
Comment 1 Szymon Brandys CLA 2012-01-17 08:11:16 EST
(In reply to comment #0)
> To fix this, it should be mandatory to specify an encoding per project. This
> can still default to the workspace default, which itself defaults to the
> platform encoding if not set by the user, but a
> .settings/org.eclipse.core.resources.prefs file with the encoding/<project>=...
> line should always be written when creating a project.

I don't see a good reason to obligatorily specify the project encoding. If your team needs it, you can always write a simple plug-in for the team that sets the encoding on project creation and validates that all projects in your workspace have it set too.
Comment 2 Dani Megert CLA 2015-10-09 12:04:49 EDT
.

*** This bug has been marked as a duplicate of bug 479450 ***