Skip to content

Commit

Permalink
handle invalid utf-8 in titles.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
drwr committed Apr 8, 2010
1 parent 3693c5c commit 85e1975
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pykdb.py
Expand Up @@ -613,7 +613,12 @@ def __readTitles(self, songDb, catalogFile, catalogPathname):
return

for line in catalogFile:
line = line.decode('utf-8').strip()
try:
line = line.decode('utf-8').strip()
except UnicodeDecodeError:
line = line.decode('utf-8', 'replace')
print "Invalid characters in %s:\n%s" % (catalogPathname, line)

if line:
tuple = line.split('\t')
if len(tuple) == 2:
Expand Down

0 comments on commit 85e1975

Please sign in to comment.