Reputation: 2358
This is my code in .py file:
description_val = str(self.description)
also I'm try:
description_val = str(self.description).encode('utf-8').decode('utf-8')
I don't ignore special character et. Malmö --> Malm
Get this error:
UnicodeEncodeError: 'ascii' codec can't encode character u'\u0160' in position 2: ordinal not in range(128)
How fix this issue?
Upvotes: 1
Views: 644
Reputation: 14746
You can achieve via changing default encoding of python.
import sys
reload(sys)
sys.setdefaultencoding("utf-8")
You can follow below link for default system encoding & change encoding.
Changing default encoding of Python?
Upvotes: 2