Bug 315934 - [IDE] Allow to set content type default encoding per project
Summary: [IDE] Allow to set content type default encoding per project
Status: ASSIGNED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: IDE (show other bugs)
Version: 3.4.2   Edit
Hardware: All All
: P3 enhancement with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-07 03:03 EDT by Ralf Hauser CLA
Modified: 2017-06-16 07:10 EDT (History)
2 users (show)

See Also:


Attachments
ConflictInEncoding.png (43.23 KB, image/png)
2010-06-07 03:07 EDT, Ralf Hauser CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ralf Hauser CLA 2010-06-07 03:03:25 EDT
Build Identifier: 20090621-0832

Since it is currently not offered, I tried to change it via "Window - Preferences - General - Content-Types - Text" but in the first few attempts I failed

Reproducible: Always
Comment 1 Ralf Hauser CLA 2010-06-07 03:07:24 EDT
Created attachment 171236 [details]
ConflictInEncoding.png

only once I expanded each sub-triangle of "Text" and wherever I found ISO-8859-1 placed UTF-8, it now appears to work.

For the 2 red circles I placed, I suggest to have a button that jumps deep down to the exact content-type where a different default (than the current ISO-8859-1) can be updated
Comment 2 Dani Megert CLA 2010-06-07 03:28:59 EDT
The defaults for certain content types like ISO-8859-1 for Java properties files or UTF-8 for XML files shouldn't be changed in general. If you desire a different encoding then you can either do that directly on the file or most likely on the project. This also has the advantage that you can share your code with other people (e.g. via repository) since the encoding data will be part of the project, which is not the case if you change the workspace defaults.
Comment 3 Ralf Hauser CLA 2010-06-07 03:37:24 EDT
Thanks for the info.
In this case, please 
1) say which specific content type is the conflicting one (I still don't know which of the myriads of content types I changed finally had the desired effect - my first guesses were wrong and had no effect)
2) add a button to the place where I can change the very content type in the project 

So as a conclusion, where I placed the red circles, my RFE is therefore

per red circle, add two buttons
a) one that lets you change the encoding default of the specific project
b) one that lets you change the encoding default platform-wide (I am fine if that is labeled deprecated and has an explanation link to https://bugs.eclipse.org/bugs/show_bug.cgi?id=315934#c2)
Comment 4 Dani Megert CLA 2010-06-07 03:48:06 EDT
>1) say which specific content type is the conflicting one
Of course with the one of your file. The file's encoding is on the same properties page, see 'Type:'. So, you'd only have to change that one but as said before this is not smart and hence we won't support to do this easily. You should simply say 'Yes' in the dialog.

As for adding a button to change the project or workspace encoding: that wouldn't help because it would still take it from the file's content type (I was wrong about that in my previous comment). The only safe thing you can really do is to change it directly on the file which then allows to share this safely with others.
Comment 5 Ralf Hauser CLA 2010-06-07 03:58:45 EDT
Thanks for the clarification, so my Type was "JSP Fragment".

I still ask you to consider my RFE "a)" in combination with below c)

Changing it directly on the file is not really feasible since 
i) I have hundreds of files that need to be changed and when I select more than one in the Navigator, the mouse-right-click context menu no longer offers to change the "Properties"

Too bad that the Content-Type Encoding apparently can only be specified on a global level and not per Project

==> RFE c) pls allow to set the Content-Type Encoding on a per project level
Comment 6 Dani Megert CLA 2010-06-07 04:12:19 EDT
>==> RFE c) pls allow to set the Content-Type Encoding on a per project level
This makes more sense ;-)
Comment 7 Prakash Rangaraj CLA 2010-06-07 04:22:52 EDT
Guess this one goes to Paul's plate.
Comment 8 Tamás Barta CLA 2017-06-16 04:14:07 EDT
I still have problems about this issue. Now JSP files default encoding cannot be set at project level. I use UTF-8 encoding but when somebody creates a workspace and imports the project it remains wrong until changes workspace default encoding from ISO-8859-1 to UTF-8. It would be fine if this encoding could come from project settings.
Comment 9 Dani Megert CLA 2017-06-16 04:30:19 EDT
(In reply to Missing name from comment #8)
> I still have problems about this issue. Now JSP files default encoding
> cannot be set at project level. I use UTF-8 encoding but when somebody
> creates a workspace and imports the project it remains wrong until changes
> workspace default encoding from ISO-8859-1 to UTF-8. It would be fine if
> this encoding could come from project settings.

Please read comment 2.
Comment 10 Tamás Barta CLA 2017-06-16 07:10:11 EDT
@Dani, yes, you are right. I wrote the same. I would like to be able to set JSP encoding at project level but I can't. I can do it by setting at files one-by-one but it is not a good solution as this rule won't work on newly created JSP files and needs to change existing files. 

This setting in org.eclipse.core.resources.prefs doesn't work for JSP files: 

encoding/<project>=UTF-8

It would be fine if I could set similar:

jsp-encoding/<project>=UTF-7