add stronger workaround for badly encoded file types

git-svn-id: http://svn.sabayonlinux.org/projects/entropy/trunk@693 cd1c1023-2f26-0410-ae45-c471fc1f0318
This commit is contained in:
(no author)
2007-11-16 09:26:36 +00:00
parent d58f0c386f
commit f44703cb8f

View File

@@ -1470,11 +1470,17 @@ def extractPkgData(package, etpBranch = etpConst['branch'], silent = False):
# when portage will use utf, test utf-8 encoding
_outcontent = set()
for i in outcontent:
i = list(i)
datatype = i[1]
try:
i[0] = i[0].encode(getfilesystemencoding())
except:
continue
except: # default encoding failed
try:
i[0] = i[0].decode("latin1") # try to convert to latin1 and then back to sys.getfilesystemencoding()
i[0] = i[0].encode(getfilesystemencoding())
except:
print "DEBUG: cannot encode into filesystem encoding -> "+str(i[0])
continue
_outcontent.add((i[0],i[1]))
outcontent = list(_outcontent)
outcontent.sort()