Categories
Python Answers

How to fix UnicodeDecodeError, invalid continuation byte with Python?

Spread the love

Sometimes, we want to fix UnicodeDecodeError, invalid continuation byte with Python.

In this article, we’ll look at how to fix UnicodeDecodeError, invalid continuation byte with Python.

How to fix UnicodeDecodeError, invalid continuation byte with Python?

To fix UnicodeDecodeError, invalid continuation byte with Python, we call decode to decode the byte string with the right encoding.

For instance, we write

s = b'\xe9\x80\x80'.decode('utf-8')

to call decode with 'utf-8' on the byte string to decode it as a Unicode string.

Conclusion

To fix UnicodeDecodeError, invalid continuation byte with Python, we call decode to decode the byte string with the right encoding.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

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