1

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?

user_odoo
  • 2,284
  • 34
  • 55

1 Answers1

2

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?

Community
  • 1
  • 1