From 04c345ae1f213c26ae50d56bdda11f372fa191be Mon Sep 17 00:00:00 2001 From: Mika Bostrom Date: Thu, 21 Jan 2010 21:46:14 +0200 Subject: [PATCH] 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. --- pyfpdb/Charset.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyfpdb/Charset.py b/pyfpdb/Charset.py index 69511cdd..f8043876 100644 --- a/pyfpdb/Charset.py +++ b/pyfpdb/Charset.py @@ -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