How to stop RTC from converting Unicode files to big endian?
I have a new Unicode (little-endian) file and I check it into RTC. I then delete the file from my eclipse workspace, ask the RTC client to refresh the sandbox and remote changes and it shows me that the file has been deleted. In the pending changes view in RTC I then right-click on the missing file and select Undo which should put the file back into my Eclipse workspace. It does, but the file is now big-endian. Checking in a new revision of the file does not rectify the problem.
I have searched the RTC client for a setting that might be affecting this and I have searched this forum but can't find any other mention of it. I would like Unicode files to keep their endianness when I store them in RTC. Can anyone help?
I am using the RTC client version 3.0.1 for Windows, running on Windows XP SP3 32bit.
Thanks,
Simon.
I have searched the RTC client for a setting that might be affecting this and I have searched this forum but can't find any other mention of it. I would like Unicode files to keep their endianness when I store them in RTC. Can anyone help?
I am using the RTC client version 3.0.1 for Windows, running on Windows XP SP3 32bit.
Thanks,
Simon.
Accepted answer
Hi Simon:
Try the following (assuming you are using the RTC Eclipse client):
1. Select the file in the project explorer or package explorer
2. Right click > Properties > Resources > Text File Encoding
Select UTF-16-LE. The RTC Eclipse client now treats this content as UTF-16-LE which is similar to UCS2 little endian.
3. Check-in the file (if it's a new file you are adding - otherwise after you modify its content) into a change set in your repo workspace and deliver to your stream. Now the RTC server knows that file in that workspace and stream are using the encoding UTF-16-LE.
4. When someone in your team accepts your changes, their version should be treated as UTF-16-LE from now on. Because the encoding was set unambiguously, there won't be random conversion to big endian anymore.
Thanks to Dmitry K. from SCM for the details.
Christophe Cornu
Try the following (assuming you are using the RTC Eclipse client):
1. Select the file in the project explorer or package explorer
2. Right click > Properties > Resources > Text File Encoding
Select UTF-16-LE. The RTC Eclipse client now treats this content as UTF-16-LE which is similar to UCS2 little endian.
3. Check-in the file (if it's a new file you are adding - otherwise after you modify its content) into a change set in your repo workspace and deliver to your stream. Now the RTC server knows that file in that workspace and stream are using the encoding UTF-16-LE.
4. When someone in your team accepts your changes, their version should be treated as UTF-16-LE from now on. Because the encoding was set unambiguously, there won't be random conversion to big endian anymore.
Thanks to Dmitry K. from SCM for the details.
Christophe Cornu
6 other answers
> I check it into RTC
Simon, what were the Source Control file properties such as content type, encoding, line delimiter after the check-in? This will help others provide the right answer. If you don't get a good answer, open a work item and attach your file (if possible) with steps. Maybe the content type and encoding have to be set right.
Christophe Cornu
Simon, what were the Source Control file properties such as content type, encoding, line delimiter after the check-in? This will help others provide the right answer. If you don't get a good answer, open a work item and attach your file (if possible) with steps. Maybe the content type and encoding have to be set right.
Christophe Cornu
I've carried out some further experiments and here are the results:
- If I change the file extension (from .txt to no extension) the problem does not occur.
- If my colleague checks the file into a component in his RTC project from his PC (with the original .txt extension) the problem does not occur.
- If my colleague checks the file into the original component in my RTC project (with the original .txt extension) on his PC the problem does not occur
- When I check the file into the original component on my PC with the original .txt extension the character encoding is shown in RTC as UTF-16
- When my colleague checks the file into the original component on his PC with the original .txt extension the character encoding is shown in RTC as UTF-16LE
- When I check the file into my component on my PC with no file extension the character encoding is shown in RTC as CP1252
So, to summarise, the problem only occurs on my PC and only with files that have a .txt file extension. I have had a hunt through the options in my RTC client for anything that might be affecting this and can't find anything. My colleague is not aware of having changed any settings that might affect it either and we're both using the same client version (3.0.1, build RTC-I20110602-0252).
If anyone knows what setting(s) might be causing this I would be very grateful if you could let me know.
Thanks again,
Simon.
- If I change the file extension (from .txt to no extension) the problem does not occur.
- If my colleague checks the file into a component in his RTC project from his PC (with the original .txt extension) the problem does not occur.
- If my colleague checks the file into the original component in my RTC project (with the original .txt extension) on his PC the problem does not occur
- When I check the file into the original component on my PC with the original .txt extension the character encoding is shown in RTC as UTF-16
- When my colleague checks the file into the original component on his PC with the original .txt extension the character encoding is shown in RTC as UTF-16LE
- When I check the file into my component on my PC with no file extension the character encoding is shown in RTC as CP1252
So, to summarise, the problem only occurs on my PC and only with files that have a .txt file extension. I have had a hunt through the options in my RTC client for anything that might be affecting this and can't find anything. My colleague is not aware of having changed any settings that might affect it either and we're both using the same client version (3.0.1, build RTC-I20110602-0252).
If anyone knows what setting(s) might be causing this I would be very grateful if you could let me know.
Thanks again,
Simon.
> - If I change the file extension (from .txt to no extension) the problem does not occur.
Probably because in that case the IDE doesn't check-it in with text/plain content type but treats it as binary and no charset conversion occurs. I'm not sure if the conversion occurs in the IDE (when an editor reads and saves the file locally) or in the RTC server (when it uploads its content during a check-in).
Can you open a work item against RTC Source Control with your file? We'll try to reproduce and get any detail necessary.
Thanks,
Christophe Cornu
Probably because in that case the IDE doesn't check-it in with text/plain content type but treats it as binary and no charset conversion occurs. I'm not sure if the conversion occurs in the IDE (when an editor reads and saves the file locally) or in the RTC server (when it uploads its content during a check-in).
Can you open a work item against RTC Source Control with your file? We'll try to reproduce and get any detail necessary.
Thanks,
Christophe Cornu