It's all about the answers!

Ask a question

How do I add a new file extension in RTC and share it with the team?

Kevin Hoyt (314) | asked Mar 31 '16, 11:45 a.m.
I'm using RTC version 5.0.2.
I need to add a new file type based upon the extension.  I see how to do this in the preferences but I don't see how to share those settings with the team.

What I need is for .utf8 files to be TEXT and utf8 encoded.  I'd rather not do that one file at a time... new files will be created and need the same settings.

Any help appreciated

Ian Wark commented Apr 01 '16, 3:28 a.m.

In Eclipse you can export your preferences from [File] > [Export] > [General] > [Preferences] and check [Export All] in the dialog that opens. It exports all non-default settings. In the file that is exported you should be able to find the file encoding setting you added. Then if you import that preference file into other Eclipse work spaces, in theory, you will get that setting as well. I think it works best when imported into a new workspace, but it is something to try.

Kevin Hoyt commented Apr 01 '16, 10:18 a.m.

  Thanks Ian.

I am hoping there is a way to check in the result or a server setting so we don't have to rely upon people importing a configuration file.  Kinda like you can do with Project Explorer and file properties.  I know I can set the properties one at a time, but that doesn't work so well when new files are created... somebody will forget to set the properties!

If not, there must be a way to configure this on the server... where else would that long list of pre-configured file extensions come from :-)

Donald Nong commented Apr 04 '16, 12:24 a.m.

I can you get confused. "File type" information never comes from the server. It's always a workspace/client configuration.

Ralph Schoon commented Apr 04 '16, 2:17 a.m.

Enterprise preference management is a huge gap in Eclipse and a host of other IDE's. I think there are companies that provide solutions for Eclipse, but I don't think there s anything you could remotely call a standard across tools. It is a shame.....

Kevin Hoyt commented Apr 04 '16, 10:04 a.m.

Client or server doesn't matter to me too much.

What I want is for me to be able to specify the encoding of a file based upon it's extension.  I know I can specify based upon the fullpath because when I set the encoding, the .settings/org.eclipse.core.resources.prefs file is updated.  I then deliver that and everyone picks it up.

What I don't like about this approach is the setting is file specific... it's only good for one file.

If I could wildcard based upon file extension, that'd be fine.

Maybe I'm asking the wrong question...

What file extensions expect the file encoding to be utf-8?  Pretty sure .xml * .js are... 

Per Donald, this is set on the client somewhere... where is this setting stored?  

Donald Nong commented Apr 05 '16, 3:35 a.m.

You're looking at the right file, and it should contains a line "encoding=UTF-8". It means that all text files are encoded in UTF-8. I don't quite understand why you said it's only good for one file. For your existing files, you need to convert them manually though.

Kevin Hoyt commented Apr 05 '16, 10:21 a.m.

 That file has several lines... one for each file I have specifically set the encoding for:


Is there one entry I can add that will set the encoding for all .utf8 files?  Something like this:

Note that I do NOT want to force the encoding to UTF8 for ALL text files, just those with the .utf8 extension.

Donald Nong commented Apr 11 '16, 3:39 a.m.

How about adding the .utf8 suffix to the existing XML content type? That's equivalent to adding "content-types/org.eclipse.core.runtime.xml/file-extensions=utf8" to the file org.eclipse.core.runtime.prefs. Basically, the XML content type is by default encoded in UTF-8, and you tell Eclipse that all .utf8 files are XML files as well.

showing 5 of 8 show 3 more comments

One answer

permanent link
Isabel Murakami (3811515) | answered Apr 05 '16, 9:40 a.m.
Please check this Enhancement Request, seems to be similar to what you are asking for:

Kevin Hoyt commented Apr 05 '16, 10:28 a.m.

I agree this is similar to what I'm asking for.  Given this enhancement was created in June of 2012 and is still open, does this mean I can NOT do what I'm asking about? 

Your answer

Register or to post your answer.