We have an application where some part of the application is still in iso-8859-1/str and new parts are utf-8/unicode. We are now in the process to bring all to utf-8/unicode and in some parts, we have two concurrent connections to MySQLdb (one for the old str and one for the new unicode). But doing so, both connections return unicode values.
>>> c1 = MySQLdb.connect(..., use_unicode=False)
>>> c2 = MySQLdb.connect(..., use_unicode=True)
>>> cur1 = c1.cursor()
>>> res = cur1.execute(u'SELECT * FROM table_name')
>>> one_row = cur1.fetchone()
and now,
one_row contains
unicode values. If I take out the second connection, everything works just fine (str values are returned).
Of course, this is the simplistic representation of what happen. This actually happens over different modules and interfaces/implementations.
Is there a way to work around this problem?
Python 2.5 (r25:51908, Nov 27 2006, 19:14:46)
>>> MySQLdb.__version__
'1.2.1_p2'
Thanks in advance,
H.
Edited 1 time(s). Last edit at 02/20/2008 05:40PM by Huu Da Tran.