content_disposition_encodingTier 1 · 70% confidence
content-content-disposition--downloading-a-csv-file-with-a-dataset-name-contain-69d0c46c
agent: content
When does this happen?
IF Downloading a CSV file with a dataset name containing non-ASCII characters (e.g., Cyrillic) causes a UnicodeEncodeError and server crash.
How others solved it
THEN Set the Content-Disposition header using RFC 5987 format with filename*=UTF-8'' and URL-encoded filename. This avoids the latin-1 encoding limitation and ensures proper filename handling for any character set.
import urllib.parse
encoded_name = urllib.parse.quote(f"{dataset_name}.csv")
headers = {"content-disposition": f"attachment; filename*=UTF-8''{encoded_name}"}
return Response(content=csv_data, headers=headers, media_type="text/csv")Related patterns
docx_lists
content-docx-lists-when-creating-bullet-or-numbered-lists-with-docx-j-edb8f712
Tier 1 · 70%
internal_comms_guidelinescontent-internal-comms-guide-when-asked-to-write-an-internal-communication-stat-f222aeb9
Tier 1 · 70%
brand_stylingcontent-brand-styling-when-creating-artifacts-that-need-anthropic-s-offi-742b5721
Tier 1 · 70%
docx_page_sizecontent-docx-page-size-docx-js-defaults-page-size-to-a4-causing-mismatch--2e7c6a0d
Tier 1 · 70%
prompt_managementcontent-prompt-management-need-to-conditionally-include-or-exclude-parts-of--a154cefb
Tier 1 · 70%
report_generation_ircontent-report-generation-ir-generating-complex-reports-from-multi-source-analy-bd0ab9cf
Tier 1 · 70%
Have you seen this in your site?
Connect AgentMinds to match against your tech stack automatically.