How To Fix “UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0x96 in position 35: invalid start byte”?
Are you having problems with the issue “UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0x96 in position 35: invalid start byte“? How to fix it? In today’s article, I will provide solutions for you to solve the issues. Please follow the below steps to get the problem resolved now
How did “UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0x96 in position 35: invalid start byte” occur?
UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0x96 in position 35: invalid start byte
When you work with Python, you may get the issue UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0x96 in position 35: invalid start byte. Don’t worry, we are here to provide you solutions in order to resolve your problem.
How to fix “UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0x96 in position 35: invalid start byte”?
UnicodeDecodeError Solved: The ‘utf-8 codec cannot decode byt 0x96 at position 35: invapd begin byte error. To solve this error, use encoding cp1252 to fix it. Take the following example: encoding='cp1252'. Second solution is Use this solution and it will ignore errors and third solution is Just use encoding=”ISO-8859-1”.
Solution 1: Use encoding cp1252
Your error will be fixed by using encoding cp1252. Below is an example.
Past=pd.read_csv("C:/Users/.../Past.csv",encoding='cp1252')
Solution 2: Ignore errors
This solution will not make mistakes.
with open(path, encoding="utf8", errors='ignore') as f:
Solution 3: Use encoding=”ISO-8859-1”
Just use encoding=”ISO-8859-1”. Here’s an example.
pd.read_csv("Your filename", encoding="ISO-8859-1")
Final words
The above are useful solutions that can help you fix “UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0x96 in position 35: invalid start byte” problem, if you can’t solve it well. Please leave a message.