Use a different "unicoder" for db strings

It seems that running encoder.encode() on a latin1/latin9 string results
in, yes a bloody UnicodeDecodeError. Decode error on .encode()...
Really. This way the modification from non-unicode string to real
unicode appears to work better.
This commit is contained in:
Mika Bostrom 2010-01-21 21:46:14 +02:00
parent dd12da302d
commit 04c345ae1f

View File

@ -33,7 +33,8 @@ def to_utf8(s):
if not_needed: return s
try:
(_out, _len) = encoder_to_utf.encode(s)
#(_out, _len) = encoder_to_utf.encode(s)
_out = unicode(s, Configuration.LOCALE_ENCODING).encode('utf-8')
return _out
except UnicodeDecodeError:
print 'Could not convert: "%s"' % s