Ticket #3370: mysql-utf8-complete.3.patch

File mysql-utf8-complete.3.patch, 1.2 KB (added by anton@…, 18 years ago)

this works well for me

  • django/db/models/base.py

     
    7777        return getattr(self, self._meta.pk.attname)
    7878
    7979    def __repr__(self):
    80         return '<%s: %s>' % (self.__class__.__name__, self)
     80        try:
     81            return '<%s: %s>' % (self.__class__.__name__, self)
     82        except UnicodeEncodeError:
     83            return '<%s: %s>' % (self.__class__.__name__, self.__str__().encode(settings.DEFAULT_CHARSET))
    8184
    8285    def __str__(self):
    8386        return '%s object' % self.__class__.__name__
  • django/db/backends/mysql/base.py

     
    8989                'db': settings.DATABASE_NAME,
    9090                'passwd': settings.DATABASE_PASSWORD,
    9191                'conv': django_conversions,
     92                'charset': 'utf8'
    9293            }
    9394            if settings.DATABASE_HOST.startswith('/'):
    9495                kwargs['unix_socket'] = settings.DATABASE_HOST
Back to Top