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:
parent
fde2f1f710
commit
c36c60155c
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user