webpy resolves Chinese appearing unicodedecodeerror: ' ASCII ' codec can ' t decode byte problem __web

Source: Internet
Author: User

In the course of learning webpy, there are unicodedecodeerror: ' ASCII ' codec can ' t decode byte 0xe6 in position 29:ordinal No in range (128) error

After Baidu reference to the following article to resolve:

Http://blog.sina.com.cn/s/blog_6c39196501013s5b.html


Resolve Unicodedecodeerror: ' ASCII ' codec can ' t decode byte 0xe5 in position 108:ordinal not in Ran (2012-02-29 10:21:59) reprint label : Topics in Categories: Python
1. Problem Description: A timed update project that was written with Python in the Django Framework, tested correctly under Windows and tested on Linux and reported the following error:
ASCII codec can ' t decode byte 0xe8 in position 0:ordinal No in range (128)
2. Reason analysis: Character problem. Character issues are easy to come by when the Windows system is turning to a Linux system.
3. Workaround: Add the following three lines to the page where the problem occurs:
Import Sys
Reload (SYS)
Sys.setdefaultencoding (' Utf-8 ')

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.