Show
Ignore:
Timestamp:
01/30/08 23:16:51 (16 years ago)
Author:
jerome
Message:

Added a workaround for buggy versions of python-mysqldb (e.g
1.2.1-p2-4 on my Debian Etch box) which have the double
encoding bug (#1521274 on sourceforge.net).

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/pykota/utils.py

    r3298 r3310  
    2626import locale 
    2727import gettext 
     28from types import UnicodeType 
    2829 
    2930def initlocale(lang="", cset=None) : 
     
    9495    """ 
    9596    if text is not None : 
    96         return text.decode("UTF-8", "replace") 
     97        if not isinstance(text, UnicodeType) : 
     98            return text.decode("UTF-8", "replace") 
     99        else :     
     100            # MySQL already returns unicode objects 
     101            return text 
    97102    else :  
    98103        return None