From e56cb24ed11ff00416e58a99737288c0230a7b37 Mon Sep 17 00:00:00 2001 From: Eric Blade Date: Fri, 29 Jan 2010 12:01:51 -0500 Subject: [PATCH] to_utf8 returns what was passed in if unicode() errors because it's already encoded --- pyfpdb/Charset.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyfpdb/Charset.py b/pyfpdb/Charset.py index d49b6219..5851683a 100644 --- a/pyfpdb/Charset.py +++ b/pyfpdb/Charset.py @@ -42,6 +42,8 @@ def to_utf8(s): except UnicodeDecodeError: sys.stderr.write('Could not convert: "%s"\n' % s) raise + except TypeError: # TypeError is raised when we give unicode() an already encoded string + return s def to_db_utf8(s): if not_needed: return s @@ -62,4 +64,3 @@ def to_gui(s): except UnicodeDecodeError: sys.stderr.write('Could not convert: "%s"\n' % s) raise -