We all know that win7 uses GBK by default, while Ubuntu uses UTF-8 by default. Sometimes ourCodeIt needs to be edited on two platforms, so it is necessary to set up the eclipse encoding. Of course, this is not only used for pydev, but also for Android ADT. You only need to set up three places to open the windows-preferences of Eclipse:
- Content typesSelect the corresponding file type, such as Python files, Java source files, and then fill in the UTF-8 in the default encoding below, remember to clickUpdateButton, otherwise...
- Editor-Text Editor-spellingTabEncodingIf the default value is UTF-8, you do not need to change it. If not, select UTF-8 in the following other. OK.
- WorkspaceTabText File EncodingSelect UTF-8.
- If it is Android, the above three steps will be OK, but pydev still needs to add a line of encoding: UTF-8 at the beginning of each py file. Manual addition is definitely not acceptable, then we set it in the template.Pydev-Editor-templatesIn the left-side navigation pane.# Encoding: UTF-8You can.
remember to set it in both Windows and ubuntu. By then, the source files opened by both parties will not be garbled.