mirror of
https://github.com/simple-login/app.git
synced 2024-11-13 07:31:12 +01:00
use utf-8 if unknown charset in get_header_unicode()
This commit is contained in:
parent
391318cbaa
commit
be510ea1d7
1 changed files with 5 additions and 0 deletions
|
@ -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 a new issue