Skip to content

Commit

Permalink
workaround unicode errors
Browse files Browse the repository at this point in the history
  • Loading branch information
cl4u2 committed Oct 21, 2012
1 parent 0bc12ef commit a2905e7
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions dbmanager.py
Expand Up @@ -117,15 +117,18 @@ def __insertRes(self, cursor, resource):
)
cursor.execute(insertionstring)
def __insertTags(self, cursor, uri, tag):
insertionstring = """
REPLACE INTO tags (
uri,
tag
) VALUES (
'%s', '%s')""" % (
uri.strip().replace("'","\\'").encode('utf-8', errors='ignore'),
tag.encode('utf-8', errors='ignore')
)
try:
insertionstring = """
REPLACE INTO tags (
uri,
tag
) VALUES (
'%s', '%s')""" % (
uri.strip().replace("'","\\'").encode('utf-8', errors='ignore'),
tag.encode('utf-8', errors='ignore')
)
except UnicodeDecodeError:
return
cursor.execute(insertionstring)
def run(self):
i = 0
Expand Down

0 comments on commit a2905e7

Please sign in to comment.