﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
30887	UnicodeEncodeError logging error with saving binary with PyMySQL driver.	Louis	nobody	"
{{{
from django.db import models

class JobContext(models.Model):
    data = models.BinaryField()

    class Meta:
        verbose_name = 'JobContext'

JobContext.objects.create(data=b'\x80\x03X\x04\x00\x00\x00xxxxq\x00.')
}}}

----
raise exception below:
Traceback (most recent call last):
  File ""/usr/local/lib/python3.7/logging/__init__.py"", line 1028, in emit
    stream.write(msg + self.terminator)
UnicodeEncodeError: 'utf-8' codec can't encode character '\udc80' in position 173: surrogates not allowed

due to File ""/usr/local/lib/python3.7/site-packages/django/db/backends/utils.py"", line 111, in execute

{{{
logger.debug(                 
                '(%.3f) %s; args=%s', duration, sql, params,                                   
                extra={'duration': duration, 'sql': sql, 'params': params}                                   
            )
}}}



"	Bug	closed	Database layer (models, ORM)	2.1	Normal	duplicate			Unreviewed	0	0	0	0	0	0
