UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf3 in Django connection with PostgreSQL in Docker

I am trying to connect my Django application to PostgreSQL running in a Docker container, but when I execute python manage.py runserver or python manage.py makemigrations, I get the following error:

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf3 in position 85: invalid continuation

What I've tried:

  • Verified that the database uses UTF-8.
  • Deleted and recreated the database in Docker with UTF-8.
  • Tested with both psycopg2 and psycopg2-binary.
  • Checked for special characters in my configuration.
  • Deleted and reinstalled my virtual environment.

What else can I check to resolve this error? Could there be some data in the database causing this issue? How can I debug which exact byte is triggering this error in PostgreSQL?

Вернуться на верх