Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix(metrics): serve CSV downloads as UTF-8 so non-ASCII titles don't mojibake - #6322

Open
soroush5 wants to merge 1 commit into
GSA:mainfrom
soroush5:fix/metrics-csv-utf8-bom
Open

fix(metrics): serve CSV downloads as UTF-8 so non-ASCII titles don't mojibake#6322
soroush5 wants to merge 1 commit into
GSA:mainfrom
soroush5:fix/metrics-csv-utf8-bom

Conversation

@soroush5

Copy link
Copy Markdown

fix(metrics): serve CSV downloads as UTF-8 so non-ASCII titles don't mojibake

Fixes #6314

Hey! Noticed the CSV exports from the metrics dashboard were coming out
garbled for anything non-English — e.g. Um novo índice shows up as
Um novo índice when opened in Excel/Sheets. Two small things were
missing: the GA export never wrote a BOM, and the S3 upload never set
a content type/charset, so browsers and spreadsheets guessed latin-1.

What I changed

  • ga.py — write \ufeff (BOM) at the start of the CSV export
  • s3_util.py — upload with ContentType: text/csv; charset=utf-8

How I verified

Added metrics/tests/test_csv_encoding.py with Portuguese (Um novo índice) and Korean titles — red before the fix (mojibake reproduced),
green after. Existing metrics tests still pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Metrics Download Full Report - Unusual Results

1 participant