"Python" Eclipse + PyDev syntaxerror:non-ascii character problem Solution __python

Source: Internet
Author: User
Eclipse + PyDev syntaxerror:non-ascii character problem solution 2011/05/05 19:40

To get a eclipse + PyDev high

The tragedy is that there are Chinese strings when Leng appear syntaxerror:non-ascii character this problem

All right, let's fix this annoying stuff.

Each code file is preceded by a #-*-coding:utf-8-*-or: # Coding=utf-8

PS: If you want to be lazy, don't want to add every new file to the top line.

You can-> Preferences->pydev->editor->templates in Windows

Select the <empty> on the right, click Edit, and then add the top line, which will automatically join the new

(You can also create a new one, but you have to choose the one you created instead of the default empty when you create the new module)

Re-compile ...

Finally without the wrong hint ...

But ...

Chinese can't output normally

Very good

and change Eclipse.

Window-> Preferences-> General-> Workspace, find "Text file Encoding", select Other, choose "UTF-8"

Ok

again to compile ...

Everything's fine.

Finish.


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.