How do you change character encoding of a file under source control
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
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.
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.