mirror of
https://github.com/moparisthebest/SickRage
synced 2025-01-07 11:58:01 -05:00
Fixed a issue with the encodingKludge and decoding of unicode data
This commit is contained in:
parent
b67c186ed8
commit
ded1e5d8a0
@ -34,6 +34,10 @@ def fixStupidEncodings(x, silent=False):
|
|||||||
return str(ftfy.fix_text(u'' + x)).decode(sickbeard.SYS_ENCODING)
|
return str(ftfy.fix_text(u'' + x)).decode(sickbeard.SYS_ENCODING)
|
||||||
except UnicodeDecodeError:
|
except UnicodeDecodeError:
|
||||||
logger.log(u"Unable to decode value: " + repr(x), logger.ERROR)
|
logger.log(u"Unable to decode value: " + repr(x), logger.ERROR)
|
||||||
|
return x
|
||||||
|
except UnicodeEncodeError:
|
||||||
|
logger.log(u"Unable to encode value: " + repr(x), logger.ERROR)
|
||||||
|
return x
|
||||||
elif type(x) == unicode:
|
elif type(x) == unicode:
|
||||||
return x
|
return x
|
||||||
else:
|
else:
|
||||||
@ -48,12 +52,13 @@ def fixListEncodings(x):
|
|||||||
else:
|
else:
|
||||||
return filter(lambda x: x != None, map(fixStupidEncodings, x))
|
return filter(lambda x: x != None, map(fixStupidEncodings, x))
|
||||||
|
|
||||||
|
|
||||||
def ek(func, *args, **kwargs):
|
def ek(func, *args, **kwargs):
|
||||||
if os.name == 'nt':
|
if os.name == 'nt':
|
||||||
result = func(*args, **kwargs)
|
result = func(*args, **kwargs)
|
||||||
else:
|
else:
|
||||||
result = func(
|
result = func(
|
||||||
*[ftfy.fix_text(u'' + x).encode(sickbeard.SYS_ENCODING) if type(x) in (str, unicode) else x for x in args],
|
*[fixStupidEncodings(x).encode(sickbeard.SYS_ENCODING) if type(x) in (str, unicode) else x for x in args],
|
||||||
**kwargs)
|
**kwargs)
|
||||||
|
|
||||||
if type(result) in (list, tuple):
|
if type(result) in (list, tuple):
|
||||||
|
@ -26,7 +26,7 @@ import os.path
|
|||||||
import regexes
|
import regexes
|
||||||
import sickbeard
|
import sickbeard
|
||||||
|
|
||||||
from sickbeard import logger, helpers, scene_numbering, common, exceptions, scene_exceptions, encodingKludge as ek, db
|
from sickbeard import logger, helpers, scene_numbering, common, exceptions as ex, scene_exceptions, encodingKludge as ek, db
|
||||||
from dateutil import parser
|
from dateutil import parser
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user