UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa1
See original GitHub issueHey guys I ran matlap2python on a matlab code but it seems like it gives me this exact error:
Traceback (most recent call last):
File "/home/arshia/Desktop/matlab2python/matlab2python.py", line 49, in <module>
main(sys.argv[1:])
File "/home/arshia/Desktop/matlab2python/matlab2python.py", line 44, in main
mparser.matlab2python(opts.filelist,opts)
File "/home/arshia/Desktop/matlab2python/matlabparser/parser.py", line 433, in matlab2python
matlab2python(f,opts)
File "/home/arshia/Desktop/matlab2python/matlabparser/parser.py", line 437, in matlab2python
MF=MatlabFile(filename=filename)
File "/home/arshia/Desktop/matlab2python/matlabparser/parser.py", line 185, in __init__
self.raw_lines=f.readlines()
File "/usr/lib/python3.10/codecs.py", line 322, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa1 in position 242: invalid start byte
I will upload the matlab file to show what I mean exactly
The error seems to have migrated from smop cause smop had the same exact issue
Issue Analytics
- State:
- Created a year ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
UnicodeDecodeError: 'utf8' codec can't decode byte 0x9c
Sometimes I get characters like this œ that cause the UnicodeDecodeError error. I need to be able to make the string UTF-8 with...
Read more >UnicodeDecodeError utf-8 codec can t decode byte in position ...
While I importing the file it shows UnicodeDecodeError: "utf-8" codec can"t decode byte 0xa0 in position ... as pd a ...
Read more >UnicodeDecodeError: 'utf-8' codec can't decode byte in position
The Python "UnicodeDecodeError: 'utf-8' codec can't decode byte in position: invalid continuation byte" occurs when we specify an incorrect encoding when ...
Read more >Python3 Fix→ UnicodeDecodeError: 'utf-8' codec can't decode ...
Python3 Fix→ UnicodeDecodeError: 'utf-8' codec can't decode byte in position. INTRO. I am in the middle of importing some D&B Business data ...
Read more >'utf8' codec can't decode byte 0xa5 in position 0: invalid start ...
Introduction · Often, while reading the input files, you might encounter an UnicodeDecodeError. · Thus, the error means that the byte 0xa05 at...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I hope so too! I’ll close the Issue until I see another of the same. Tried on the codes and both worked!
Tyvm
Sounds good, I’ve submitted a small correction. Encoding errors are always a bit of a pain. The alternative would be to detect the encoding using
chardet
, but hopefully this workaround is enough.