Fix Python SyntaxError: Non-UTF-8 code starting with ‘\xe8’ in file: A Step Guide – Python Tutorial

By | May 24, 2020

When you are learning python programming, you may encounter this error: SyntaxError: Non-UTF-8 code starting with ‘\xe8’ in file. In this tutorial, we will introduce you how to fix this error.

This Non-UTF-8 error likes:

Fix python SyntaxError - Non-UTF-8 code starting with

How to fix this SyntaxError?

To fix this SyntaxError is very easy, we should add code # -*- coding:utf-8 -*-

 at the top of our python script.

Here is an example:

# -*- coding:utf-8 -*-
import hashlib
import base64

Then you will find this error is fixed.

Leave a Reply

Your email address will not be published. Required fields are marked *