Installing Eclipse or MyEclipse on a Chinese Windows operating system defaults to setting Eclipse's encoding to GBK, which is consistent with the operating system's default encoding.
With this default setting, files added to eclipse are not automatically detected by Team Explorer, only in detected changes , and must be added to included changes by using the promote method (i)
Figure one: Only new files can be queried for changes that have been checked
Figure II: Notification of changes to the monitored file (new file)
By submitting the above-mentioned method to a file on the service, TFS marks it as UTF-8 and reads and analyzes it in a UTF-8 way (iii)
Figure III: Encoding format for tagged documents in TFS
This way, if there are Chinese characters in the document, garbled display (d) will occur, and the merging of changesets will fail because of inconsistent encoding format, resulting in the failure of the comparison.
Figure Four: Chinese display garbled
To avoid this problem, it is recommended that all teams unify Eclipse's encoding settings before developing the project, see Eclipse's workspace encoding set to UTF-8 encoding (v)
Figure V: Set the workspace encoding for Eclipse
There are several benefits to using this setting:
1. Avoid garbled problems caused by Eclipse and TFS coding inconsistencies
2. Team Explorer in Eclipse automatically detects new files and automatically adds them to the included changes
2. The files in Eclipse support Chinese, English, and other non-English text, such as Japanese, Korean. If you use GBK encoding, you must re-encode the code back to UTF-8 if you need Korean in your code. When the project is developed to a certain scale and then the coding, it will be a very troublesome job
Everything has two sides, if you import a project that uses GBK encoding into TFS, and then modify the encoding of the project to UTF-8, the original code in the Chinese can not display properly, it is necessary to manually adjust to a UTF-8, is also a small job.
So developers need to write code before the programming of the coding, while in the team unified coding specifications and settings, to avoid a team coding format is not the same, you use UTF-8 I use GBK, integration code, not normal browsing other members of the code.
GBK or UTF-8? Eclipse connects the coding pains of TFS! encoding, encoding, encoding ...