I'm using postgresql with a utf8 charset. I have some unicode text that is stored in a story field of the GlobalLuminaria model.
I'm getting this error:
GlobalLuminaria.objects.filter(story__icontains=u'Hvis bare').first().delete()
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/app/.heroku/python/lib/python3.11/site-packages/django/db/models/query.py", line 1057, in first
for obj in queryset[:1]:
File "/app/.heroku/python/lib/python3.11/site-packages/django/db/models/query.py", line 398, in __iter__
self._fetch_all()
File "/app/.heroku/python/lib/python3.11/site-packages/django/db/models/query.py", line 1881, in _fetch_all
self._result_cache = list(self._iterable_class(self))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.heroku/python/lib/python3.11/site-packages/django/db/models/query.py", line 91, in __iter__
results = compiler.execute_sql(
^^^^^^^^^^^^^^^^^^^^^
File "/app/.heroku/python/lib/python3.11/site-packages/django/db/models/sql/compiler.py", line 1593, in execute_sql
return list(result)
^^^^^^^^^^^^
File "/app/.heroku/python/lib/python3.11/site-packages/django/db/models/sql/compiler.py", line 2091, in cursor_iter
for rows in iter((lambda: cursor.fetchmany(itersize)), sentinel):
File "/app/.heroku/python/lib/python3.11/site-packages/django/db/models/sql/compiler.py", line 2091, in <lambda>
for rows in iter((lambda: cursor.fetchmany(itersize)), sentinel):
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.heroku/python/lib/python3.11/site-packages/django/db/utils.py", line 98, in inner
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 84: ordinal not in range(128)```