still efforts in difficult chars

This commit is contained in:
q
2014-08-17 16:11:51 +03:00
parent 6a1bb35d9b
commit 0b19f6588f

View File

@@ -213,7 +213,15 @@ def get_folder_contents(db,path):
files=[] files=[]
db.execute("SELECT file FROM list where file LIKE ?",(path+'%',)) db.execute("SELECT file FROM list where file LIKE ?",(path+'%',))
for row in db: for row in db:
try:
base=row[0].decode('utf-8').replace(path,'',1) base=row[0].decode('utf-8').replace(path,'',1)
except UnicodeDecodeError:
print(row[0]+" is giving me trouble.")
try:
base=row[0].encode('utf-8').replace(path,'',1)
except UnicodeDecodeError:
print(row[0]+" is still giving me trouble.")
sys.exit(1)
if base.find('/')==-1: if base.find('/')==-1:
files.append(base) files.append(base)
return files return files