From f44703cb8fadbca36dbd783db8b4d557d1ff7e80 Mon Sep 17 00:00:00 2001 From: "(no author)" <(no author)@cd1c1023-2f26-0410-ae45-c471fc1f0318> Date: Fri, 16 Nov 2007 09:26:36 +0000 Subject: [PATCH] add stronger workaround for badly encoded file types git-svn-id: http://svn.sabayonlinux.org/projects/entropy/trunk@693 cd1c1023-2f26-0410-ae45-c471fc1f0318 --- libraries/entropyTools.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libraries/entropyTools.py b/libraries/entropyTools.py index 8cb077696..84ef21571 100644 --- a/libraries/entropyTools.py +++ b/libraries/entropyTools.py @@ -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()