Delete every non utf-8 symbols from string

Try below code line instead of last two lines. Hope it helps:

line=line.decode('utf-8','ignore').encode("utf-8")

Leave a Comment