header encoding issue??? #3044
Replies: 1 comment 2 replies
-
Replaced ascii in _utils.py with UTF-8 and discovered the real issue related to header encoding. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
receiving the following error:
venv/lib64/python3.11/site-packages/httpx/_utils.py", line 53, in normalize_header_value
return value.encode(encoding or "ascii")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2018' in position 7: ordinal not in range(128)
I am not directly calling the httpx module, it is being referenced by gradio which in turns passes on the request headers via the browser. I believe that is where the breakdown occurs. My understanding of the code and from forums is that by default UTF-8 should be the encoding utilized. If this is the case, I am unclear why httpx falls back to using ascii. I am running Python 3.11 on Oracle Linux 8 and have doublechecked all my environment variables. My code works fine on my Mac. Happy to provide additional details.
Beta Was this translation helpful? Give feedback.
All reactions