There are many questions and fixes for this but none seems to work for me. My problem is I am reading a file with strings and loading each line into DB.
In file it is looking like normal text,while in DB it is read as a unicode space. I tried replacing it with a space and similar options but none worked.
For example in text file the string will be like:
The abrupt departure
After inserted in DB, there it is looking like:
The abrupt departure
When I am trying to run query for data in DB, it is looking like:
"The abrupt\xc2\xa0departure"
I tried the following:
if "\xc2\xa0" in str:
str.replace('\xa0', ' ')
str.replace('\xc2', ' ')
print str
the above code is printing the string like:
The abrupt departure
but while inserting back to DB, it is still the same.
Any help is appreciated.