close

[Solved] UnicodeDecode: ‘utf8’ codec can’t decode byte 0xc3 in position 34: unexpected end of data

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error UnicodeDecode: ‘utf8’ codec can’t decode byte 0xc3 in position 34: unexpected end of data in python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How UnicodeDecode: ‘utf8’ codec can’t decode byte 0xc3 in position 34: unexpected end of data Error Occurs?

Today I get the following error UnicodeDecode: ‘utf8’ codec can’t decode byte 0xc3 in position 34: unexpected end of data in python.

How To Solve UnicodeDecode: ‘utf8’ codec can’t decode byte 0xc3 in position 34: unexpected end of data Error ?

  1. How To Solve UnicodeDecode: 'utf8' codec can't decode byte 0xc3 in position 34: unexpected end of data Error ?

    To Solve UnicodeDecode: 'utf8' codec can't decode byte 0xc3 in position 34: unexpected end of data Error Open the csv file in sublime and “Save with Encoding” -> UTF-8.

  2. UnicodeDecode: 'utf8' codec can't decode byte 0xc3 in position 34: unexpected end of data

    To Solve UnicodeDecode: 'utf8' codec can't decode byte 0xc3 in position 34: unexpected end of data Error Open the csv file in sublime and “Save with Encoding” -> UTF-8.

Solution 1

site[i:i+35].decode('utf-8')

You cannot randomly partition the bytes you’ve received and then ask UTF-8 to decode it. UTF-8 is a multibyte encoding, meaning you can have anywhere from 1 to 6 bytes to represent one character. If you chop that in half, and ask Python to decode it, it will throw you the unexpected end of data error.

Look into a tool that has this built for you. BeautifulSoup or lxml are two alternatives.

Solution 2

Open the csv file in sublime and “Save with Encoding” -> UTF-8.

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read