to_utf8 returns what was passed in if unicode() errors because it's already encoded
This commit is contained in:
parent
23e0611978
commit
e56cb24ed1
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user