I have the below code
stream = io.StringIO(csv_file.stream.read().decode('utf-8-sig'), newline=None) // error is here
reader = csv.DictReader(stream)
list_of_entity = []
line_no, prev_len = 1, 0,
for line in reader:
While executing the above code I got the below error.
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa0 in position 252862: invalid start byte
Later to fix this I tried the below.
stream = io.StringIO(csv_file.stream.read().decode('unicode_escape'), newline=None)
reader = csv.DictReader(stream)
list_of_entity = []
line_no, prev_len = 1, 0,
for line in reader:// error is here
when i change decode as
unicode_escape
it thrown the error "_csv.Error: line contains NULL byte" at above highlighted comment line.
There is null byte present in csv, I want to ignore or replace it. can anyone help on this.