It's all about the answers!

Ask a question

How to stop RTC from converting Unicode files to big endian?


Simon Fox (3556) | asked Jan 05 '12, 7:47 a.m.
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.

Accepted answer


permanent link
Christophe Cornu (47123) | answered Jan 11 '12, 7:31 p.m.
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
Simon Fox selected this answer as the correct answer

6 other answers



permanent link
Simon Fox (3556) | answered Jan 06 '12, 8:27 a.m.
In case it makes any difference, the files in question are in UCS2 encoding and have the .txt file extension.

Simon.

permanent link
Christophe Cornu (47123) | answered Jan 07 '12, 9:01 p.m.
> 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

permanent link
Simon Fox (3556) | answered Jan 10 '12, 4:22 a.m.
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.

permanent link
Christophe Cornu (47123) | answered Jan 11 '12, 4:28 p.m.
> - 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

permanent link
Simon Fox (3556) | answered Jan 12 '12, 11:19 a.m.
Many thanks Christophe - that does indeed fix it.

I'm still not sure why my colleague doesn't have the same issue but at least I have a solution :-)

Thanks again,

Simon.

permanent link
Makson Lee (41024241) | answered Aug 12 '13, 9:13 p.m.
We have similar issue, file is encoded as UTF16-BE if we load it into 64bit Windows OS, but UTF16-LE if we load it into 32bit Windows OS.

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.