Skip to content

UnicodeDecodeError on save of model instance with non-ASCII bytestring field value #422

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kmtracey opened this issue Oct 22, 2013 · 0 comments

Comments

@kmtracey
Copy link

environment: Django 1.5.4, Python 2..7.3

dev level debug toolbar is raising UnicodeDecodeError on save of a model instance where one of the field values in the model instance being saved is a bytestring containing non-ASCII characters. End of traceback is:

File "/home/kmtracey/projects/ccsr/ccsr_sam/sam/survey/forms.py" in save
  76.                 self.instance.save()
File "/home/kmtracey/projects/ccsr/ccsr_sam/sam/survey/models.py" in save
  252.         super(Survey, self).save(*args, **kwargs)
File "/home/kmtracey/.virtualenvs/ccsr1.5/local/lib/python2.7/site-packages/django/db/models/base.py" in save
  546.                        force_update=force_update, update_fields=update_fields)
File "/home/kmtracey/.virtualenvs/ccsr1.5/local/lib/python2.7/site-packages/django/db/models/base.py" in save_base
  626.                             rows = manager.using(using).filter(pk=pk_val)._update(values)
File "/home/kmtracey/.virtualenvs/ccsr1.5/local/lib/python2.7/site-packages/django/db/models/query.py" in _update
  605.         return query.get_compiler(self.db).execute_sql(None)
File "/home/kmtracey/.virtualenvs/ccsr1.5/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py" in execute_sql
  1014.         cursor = super(SQLUpdateCompiler, self).execute_sql(result_type)
File "/home/kmtracey/.virtualenvs/ccsr1.5/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py" in execute_sql
  840.         cursor.execute(sql, params)
File "/home/kmtracey/.virtualenvs/ccsr1.5/local/lib/python2.7/site-packages/debug_toolbar/utils/tracking/db.py" in execute
  140.                     self.cursor, sql, self._quote_params(params)),
File "/home/kmtracey/.virtualenvs/ccsr1.5/local/lib/python2.7/site-packages/debug_toolbar/utils/tracking/db.py" in _quote_params
  87.         return list(map(self._quote_expr, params))
File "/home/kmtracey/.virtualenvs/ccsr1.5/local/lib/python2.7/site-packages/debug_toolbar/utils/tracking/db.py" in _quote_expr
  76.             element = element.replace("'", "''")

Exception Type: UnicodeDecodeError at /uccsparent/survey/dashboard/parent/
Exception Value: 'ascii' codec can't decode byte 0xe2 in position 6782: ordinal not in range(128)
ryneeverett pushed a commit to ryneeverett/django-debug-toolbar that referenced this issue Oct 2, 2016
ryneeverett pushed a commit to ryneeverett/django-debug-toolbar that referenced this issue Oct 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant