Solution to Chinese garbled characters in python development environment

Source: Internet
Author: User
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, and 3.1, and can be switched as needed. 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, and 3.1, and can be switched as needed.

">

PyScripter looks like a good python ide.

Environment:

PyScripter 2.6.0.0

Python3.4

Problem:

PyScripter has a small Pitfall. after opening the file, Chinese characters become garbled. The new file in PyScripter can display Chinese characters normally, but the Chinese characters are garbled after it is re-opened.

PyScripter Chinese garbled characters:

The reason is that if there is no encoding declaration in the file header, PyScripter will open the file using ANSI by default.

PyScripter default file template does not contain encoding declaration, re-open the file time is not opened in UTF-8, so garbled.

Solution:

1. open the file in another editor, add the declaration and save the statement:

# -*- coding: UTF-8 -*-

2. modify the file template of PyScripter and add the previous line:

# -*- coding: UTF-8 -*-

In this way, this line of code declaration is automatically included every time you create a python code file using PyScripter. Very convenient -_-!

Procedure: Tools → Options → File template → python script → then add the encoding declaration to the template:

# -*- coding: UTF-8 -*-

→ Click Update !!! This step is very important. remember to click Update to save the changes.

All configurations of PyScripter are saved in PyScripter. ini. The path is your user directory/AppData \ Roaming \ PyScripter/PyScripter. ini.

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

The above is a detailed description of the python development environment PyScripter Chinese garbled problem solution. For more information, please refer to other related articles in the first PHP community!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.