Detailed explanation of the solution to the Chinese garbled problem in the python development environment PyScripter

高洛峰
Release: 2017-03-28 15:33:33
Original
2497 people have browsed it

<br>

PyScripter is an open source Python integrated development environment (IDE) developed using Delphi. PyScripter supports Python2.4, 2.5, 2.6, 2.7, 3.0, 3.1, 3.2, and can be used according to Need to switch.

">

PyScripter looks like a pretty good python ide

Environment:

PyScripter 2.6.0.0

python3.4

Problem:

PyScripter has a small pit, after opening the file, the Chinese language All become garbled characters. The Chinese characters of the newly created files in PyScripter can be displayed normally, but the Chinese characters are garbled after reopening.

The reason for the Chinese characters of PyScripter:

The reason is that if there is no encoding statement in the file header, Then PyScripter will use ANSI to open the file by default.

And PyScripter's default file template does not have an encoding statement, and the file will not be opened in UTF-8 when it is reopened, so

. Solution:

1. Open the file with another editor, add this line of statement and save it:

# -*- coding: UTF-8 -*-<br>

2. Modify the file template of PyScripter and add this line:

# -*- coding: UTF-8 - *-<br>

##This way, every time you create a new python code file with PyScripter, this line of code statement will be automatically included. It is very, very convenient -_-!

Detailed operation. Steps: Tools → Options → File template → python script → Then add the encoding statement in the template:

# -*- coding: UTF-8 -*-<br>

→ Click Update! ! ← This step is very important. Remember to click Update to save

The path is your user directory/. AppData\Roaming\PyScripter/PyScripter.ini

C:\Users\Administrator\AppData\Roaming\PyScripter

The above is the detailed content of Detailed explanation of the solution to the Chinese garbled problem in the python development environment PyScripter. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template