Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change default encoding to utf-8 in normalize_header_key and normalize_header_value functions #3241

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions httpx/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def normalize_header_key(
if isinstance(value, bytes):
bytes_value = value
else:
bytes_value = value.encode(encoding or "ascii")
bytes_value = value.encode(encoding or "utf-8")

return bytes_value.lower() if lower else bytes_value

Expand All @@ -50,7 +50,7 @@ def normalize_header_value(value: str | bytes, encoding: str | None = None) -> b
"""
if isinstance(value, bytes):
return value
return value.encode(encoding or "ascii")
return value.encode(encoding or "utf-8")


def primitive_value_to_str(value: PrimitiveData) -> str:
Expand Down
Loading