Skip to content

Commit

Permalink
Add comment for ASGI encoding spec and change to unicode_escape
Browse files Browse the repository at this point in the history
  • Loading branch information
rocky-ken committed Sep 5, 2024
1 parent 118f259 commit 4d596a2
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -945,4 +945,7 @@ def _decode_header_item(value):
try:
return value.decode("utf-8")
except ValueError:
return value.decode("latin-1")
# ASGI header encoding specs, see:
# - https://asgi.readthedocs.io/en/latest/specs/www.html#wsgi-encoding-differences (see: WSGI encoding differences)
# - https://docs.python.org/3/library/codecs.html#text-encodings (see: Text Encodings)
return value.decode("unicode_escape")

0 comments on commit 4d596a2

Please sign in to comment.