@@ -37,14 +37,15 @@ def toUnicode(original, *args):
|
|||||||
except:
|
except:
|
||||||
try:
|
try:
|
||||||
detected = detect(original)
|
detected = detect(original)
|
||||||
if detected.get('encoding') == 'utf-8':
|
try:
|
||||||
return original.decode('utf-8')
|
return original.decode(detected.get('encoding'))
|
||||||
return ek(original, *args)
|
except:
|
||||||
|
return ek(original, *args)
|
||||||
except:
|
except:
|
||||||
raise
|
raise
|
||||||
except:
|
except:
|
||||||
log.error('Unable to decode value "%s..." : %s ', (repr(original)[:20], traceback.format_exc()))
|
log.error('Unable to decode value "%s..." : %s ', (repr(original)[:20], traceback.format_exc()))
|
||||||
return toSafeString(original)
|
return 'ERROR DECODING STRING'
|
||||||
|
|
||||||
|
|
||||||
def ss(original, *args):
|
def ss(original, *args):
|
||||||
@@ -91,7 +92,7 @@ def ek(original, *args):
|
|||||||
if isinstance(original, (str, unicode)):
|
if isinstance(original, (str, unicode)):
|
||||||
try:
|
try:
|
||||||
from couchpotato.environment import Env
|
from couchpotato.environment import Env
|
||||||
return original.decode(Env.get('encoding'))
|
return original.decode(Env.get('encoding'), 'ignore')
|
||||||
except UnicodeDecodeError:
|
except UnicodeDecodeError:
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user