Set PyCharm Default Character Encoding
The method for setting the default character encoding in PyCharm is as follows:
- Open PyCharm and click on the “File” option in the menu bar.
 - Choose Settings.
 - In the pop-up dialog box, choose Editor -> File Encodings.
 - Locate the options for Default encoding for properties files and Default encoding for XML files in the interface on the right side.
 - Choose the encoding method you prefer, such as UTF-8, GB2312, etc.
 - Simply click OK to save the settings.
 
After setting this up, PyCharm will use your selected default character encoding to open and save files.