Skip to content

Commit

Permalink
minidb: Fix encoding issue (bug 1088)
Browse files Browse the repository at this point in the history
Make sure that utf-8 strings are converted
to unicode before sending to the database.
  • Loading branch information
thp committed Feb 3, 2011
1 parent cfa838d commit b13123d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/gpodder/minidb.py
Expand Up @@ -85,8 +85,10 @@ def _register(self, class_):
', '.join('%s TEXT'%s for s in slots)))

def convert(self, v):
if isinstance(v, str) or isinstance(v, unicode):
if isinstance(v, unicode):
return v
elif isinstance(v, str):
return v.decode('utf-8')
else:
return str(v)

Expand Down

0 comments on commit b13123d

Please sign in to comment.