https://github.com/encode/starlette/blob/master/starlette/responses.py - appears UTF incompatible (Line 58 and probably other places) #2579
Unanswered
mxav1111
asked this question in
Potential Issue
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi team
I searched and couldn't find any open issue around this.
Encountered an issue while working on small project that involves UTF-8 double byte character set. In this specific case, it happens to be Hindi (Indian Language).
When filename is in hindi language , such as :- ब्रह्मवर्चसकीध्यानधारणा.txt, following error appears in log : -
=====
File "/home/pta/.pyenv/versions/3.12.2/envs/pyenv_flet1/lib/python3.12/site-packages/starlette/responses.py", line 297, in init
self.init_headers(headers)
File "/home/pta/.pyenv/versions/3.12.2/envs/pyenv_flet1/lib/python3.12/site-packages/starlette/responses.py", line 58, in init_headers
(k.lower().encode("latin-1"), v.encode("latin-1"))
^^^^^^^^^^^^^^^^^^^
Changed responses.py to : -
k.lower().encode("utf-8"), v.encode("utf-8"))
Thereafter Error went away and file was downloaded with no issues any more.
Beta Was this translation helpful? Give feedback.
All reactions