gnue-common bug: mysqldbdrv.py with MySQLdb 1.2.2 always decodes query result using latin1

Oleg Noga <[email protected]> Wed, 20 Jun 2007 21:43:50 +0300
Newsgroups gmane.comp.gnu.enterprise.general
Message-ID <[email protected]>
Hello,

There is a bug in mysqldbdrv.py with MySQLdb 1.2.2 with
client encoding different to latin1.
It still decodes query result (to unicode) using latin1.

The solution is to pass charset to Connection constructor.

MySQLdb 1.2.2 calls SET NAMES internally so it is no more required to
do it from mysqldbdrv.py

-- 
Best regards,
 Oleg                          mailto:[email protected]

_______________________________________________
Gnue mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/gnue
mysqldbdrv.diff (application/octet-stream, 488 B)
*** mysqldbdrv.bak	Wed Jun 20 21:39:23 2007
--- mysqldbdrv.py	Wed Jun 20 21:39:59 2007
***************
*** 147,150 ****
      if int(srv_version) == 5 and mySQL_encTable.has_key (self._encoding):
!         kwargs ['init_command'] = ('SET NAMES %s' %
!                 mySQL_encTable[self._encoding])
      else:
--- 147,149 ----
      if int(srv_version) == 5 and mySQL_encTable.has_key (self._encoding):
!       kwargs['charset'] = mySQL_encTable[self._encoding]
      else: