4

Problem

I have an eclipse project that is committed to source control.

The project looks something like this:

MyProject
    .classpath
    .project
    src/
        com/myCompany/code
            DoStuff.java
            DoOtherStuff.java
            someText.foo
    conf
        someOtherTextFile.foo

As you can see we have files of file extension foo. The foo files use a different file encoding (ISO-8859-1) then the rest of the files in my project. I want to configure eclipse to use ISO-8859-1 whenever those files are opened.

Here are the options that I have found so far:

Solution 1 - Mark each file one by one

Right Click File -> Properties -> Text file encoding -> Other: ISO-8859-1

This then adds a line to .settings/org.eclipse.core.resources.prefs:

encoding//conf/someOtherTextFile.foo=ISO-8859-1

This solution works ok, but I need to do it for every foo file in my project and I need to make sure that no one ever forgets to do it when they add a new foo file.

Solution 2 - Configure it in my workplace settings

This is done like this:

Open the Eclipse Preferences and go to 'General > Content Types'.

Select the type of the file, for example 'Text'

In the File Associations area click 'Add' and add '*.foo'. Enter 'ISO-8859-1' in the 'Default Encoding' field.

Click OK and you should be set.

(Thanks greg-449 for clarifying how to do this).

This solution does not work for my team because we don't commit the Eclipse workspace settings into source control (we only commit the project settings).

What I really want to do

I would like to be able to say that all files in the project ending with .foo should be displayed with the encoding ISO-8859-1. I need to configure this at the project level because my team commits project settings into source control but not workspace settings.

Any hints on how to do this?

Community
  • 1
  • 1
sixtyfootersdude
  • 25,859
  • 43
  • 145
  • 213

1 Answers1

-1

Greg-449 already explained you the steps, I am pasting the same explanation with screenshots:

Windows -> Preference -> General -> Content Types -> Text ->Add -> *.foo -> ok -> click on *.foo and fill the Default encoding as 'ISO-8859-1' -> update -> ok

Preferences

Content Types

File association

File encoding

SyntaX
  • 2,090
  • 17
  • 30
  • 1
    @BirkramKundu - Thanks for the diagram. This solution is the same as what I described in "Solution 2" and doesn't answer the question. – sixtyfootersdude Nov 11 '15 at 15:30