Read strings from database as utf-8 in minidb

This commit is contained in:
Thomas Perl 2010-05-18 11:59:08 +02:00
parent 5a16cd38e4
commit a725418c82

View file

@ -51,7 +51,9 @@ class Store(object):
# Set a slot on the given object to value, doing a cast if
# necessary. The value None is special-cased and never cast.
cls = o.__class__.__slots__[slot]
if value is not None and cls != str and cls != unicode:
if value is not None:
if isinstance(value, unicode):
value = value.decode('utf-8')
value = cls(value)
setattr(o, slot, value)