mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-18 05:51:26 +02:00
fixed #114
Falling back to automated decoding in case of an unknown charset.
This commit is contained in:
+4
-1
@@ -101,7 +101,10 @@ def ajax_response(request, status="ok", url=None, template=None, **kwargs):
|
||||
|
||||
def decode(s, encodings=('utf8', 'latin1', 'windows-1252', 'ascii'), charset=None):
|
||||
if charset is not None:
|
||||
return s.decode(charset, 'ignore')
|
||||
try:
|
||||
return s.decode(charset, 'ignore')
|
||||
except LookupError:
|
||||
pass
|
||||
|
||||
for encoding in encodings:
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user