It's all about the answers!

Ask a question

How do you change character encoding of a file under source control


Norman Dignard (356696177) | asked Feb 24 '15, 11:49 a.m.
retagged Mar 02 '15, 5:20 p.m. by Ken Tessier (84117)

We stumbled across some c code (.cpp file) that is causing us a little grief that we are trying to resolve.

We have a number of cpp files under source control in but for some reason this one file gives us a "unsupported character encoding" on trying to open the file.   In thre RTC client we can set the encoding UTF8 to see  its contents but the "change" does not stick.  

How do we change the encoding on a file already checked in?  This file has does have french characters but i don't think this is an issues as coping the file aside (within the workspace) opens without issue. 

 

Accepted answer


permanent link
Lily Wang (4.9k714) | answered Feb 25 '15, 1:07 a.m.
Hi Norman,

To change the file's encoding on server side, you need to load the file into an Eclipse project, then right-click the file and select "Properties". In the Properties, set the file encoding to "UTF-8". Then you need to make slightly change on the file content, so you can check-in/deliver the file from Pending Changes.
After that if you open the repository files from the workspace or stream and check it properties, you can see the file encoding is updated.

You mentioned this is a .cpp file. if you are using Visual Studio client, there's no direct way to modify a single file's properties. You need to edit magic.properties file (refer to https://jazz.net/help-dev/clm/index.jsp?re=1&topic=/com.ibm.team.scm.doc/topics/t_magicproperties.html&scope=null) to change the file's encoding on client side first, then modify the file and check-in to server side.

Ralph Schoon selected this answer as the correct answer

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.