characters getting inserted into beginning of file.
Some developers alerted me to characters in the beginning of c sharp files. These files are text based. When ever I tried to open a file in RTC to verify this it would open in Visual Studio. Then I created a file association to open cs files using a text editor. Once I did this, if I opened a file I saw those strange characters. For an experiment I removed those characters, did a refresh in the pending changes view and then compared the differences. RTC is reporting a change but the difference isn't showing anything.
3 answers
Those characters belong in the file. They are a Byte Order Mark (BOM) that identifies the character encoding of the file. Any text editor that shows those characters is not interpreting the encoding of the file properly. You wont see the characters in Eclipse-based (i.e. RTC client) or the VS clients because they interpret the BOM properly. You can google "UTF-8 BOM Visual Studio" if you want to learn more about this.
Those characters belong in the file. They are a Byte Order Mark (BOM) that identifies the character encoding of the file. Any text editor that shows those characters is not interpreting the encoding of the file properly. You wont see the characters in Eclipse-based (i.e. RTC client) or the VS clients because they interpret the BOM properly. You can google "UTF-8 BOM Visual Studio" if you want to learn more about this.
Except I do see those characters in RTC client. Also I see strange characters in other parts of the file. I see this in line 10 of a file:
//* 2010
A developer sent me this:
Then it is an issue with their merge utility. Because they are duplicating these characters at the beginning of the file when they merge a file that has changes at the beginning of the file. I think you will be able to recreate the issue by creating a file with several lines of text. Then under a separate user make changes at the top of the file (like adding the standard comments we put at the top of source code.) Then check in and deliver the change as that user. Then as the original user prior to accepting these changes, make changes to the top of the file and check it in. When the system merges the files it should cause a conflict. Click the little arrow to combine the text at the top of the file, I am betting you will see it duplicate these characters at the top of the file.
And last night he sent me this :
I confirmed several times tonight that this should recreate the issue. The interesting thing is that I found a follow on issue. When this happens the encoded file type can change and special characters can be corrupted. Here is an example below.
configurationCommand = configurationCommand.Replace("' key='", "");
configurationCommand = configurationCommand.Replace("' value='", "");
configurationCommand = configurationCommand.Replace("'", "");
string[] words = configurationCommand.Split('');
was changed to
configurationCommand = configurationCommand.Replace("' key='", "");
configurationCommand = configurationCommand.Replace("' value='", "");
configurationCommand = configurationCommand.Replace("'", "");
string[] words = configurationCommand.Split('');