Private GIT

Skip to content
Snippets Groups Projects
Commit ed143d5c authored by Dustyn Gibson's avatar Dustyn Gibson
Browse files

Text factory decoding order change - Fixes SiCKRAGETV/sickrage-issues#2319

parent fdd4ec6b
Branches
Tags
No related merge requests found
......@@ -229,19 +229,23 @@ class DBConnection(object):
def _unicode_text_factory(self, x):
try:
# Already unicode, empty string, or ascii
x = unicode(x)
except Exception:
try:
x = unicode(x, sickbeard.SYS_ENCODING)
except Exception:
try:
# most common encoding from web
x = unicode(x, 'utf-8')
except Exception:
try:
# most common from web if utf-8 fails
x = unicode(x, 'latin-1')
except Exception:
try:
# Chardet can be wrong, so try it before ignoring
# try system encoding before trusting chardet
x = unicode(x, sickbeard.SYS_ENCODING)
except Exception:
try:
# Chardet can be wrong, so try it last before ignoring
x = unicode(x, chardet.detect(x).get('encoding'))
except Exception:
x = unicode(x, sickbeard.SYS_ENCODING, errors="ignore")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment