mirror of
https://github.com/simple-login/app.git
synced 2024-09-28 20:51:29 +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)
|
||||
except UnicodeDecodeError:
|
||||
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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user