mirror of
https://github.com/simple-login/app.git
synced 2024-09-30 05:31:30 +02:00
use utf-8 if unknown charset in get_header_unicode()
This commit is contained in:
parent
391318cbaa
commit
be510ea1d7
@ -603,6 +603,11 @@ def get_header_unicode(header: str):
|
|||||||
return decoded_string.decode(charset)
|
return decoded_string.decode(charset)
|
||||||
except UnicodeDecodeError:
|
except UnicodeDecodeError:
|
||||||
LOG.warning("Cannot decode header %s", header)
|
LOG.warning("Cannot decode header %s", header)
|
||||||
|
except LookupError: # charset is unknown, e.g.
|
||||||
|
LOG.exception(
|
||||||
|
"Cannot decode %s with %s, use utf-8", decoded_string, charset
|
||||||
|
)
|
||||||
|
return decoded_string.decode("utf-8")
|
||||||
|
|
||||||
return header
|
return header
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user