Skip to content

Commit 3b4d4d0

Browse files
committed
fix(plugin-report): spell the CSV byte-order mark as an escape, not a raw byte
Claude-Session: https://claude.ai/code/session_01JQwxbYfDeaywgrS5N1PZfg Co-authored-by: Claude <noreply@anthropic.com>
1 parent 54aa045 commit 3b4d4d0

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

‎ui/packages/plugin-report/src/ReportExport.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ export function ReportExportControl({ exportOptions, label, name, snapshot }: Re
198198
const fileName = buildExportFileName(format, { prefix, label: reportLabel, objectName: name });
199199
if (format === 'csv') {
200200
// The BOM makes Excel open a UTF-8 CSV as UTF-8 (non-Latin labels).
201-
downloadBlob(new Blob(['', buildReportCsv(snapshot, includeHeaders)], { type: 'text/csv;charset=utf-8' }), fileName);
201+
downloadBlob(new Blob(['\uFEFF', buildReportCsv(snapshot, includeHeaders)], { type: 'text/csv;charset=utf-8' }), fileName);
202202
} else {
203203
const bytes = await buildReportXlsx(snapshot, includeHeaders, reportLabel || 'Report');
204204
downloadBlob(new Blob([bytes], { type: XLSX_MIME }), fileName);

‎ui/packages/plugin-report/src/__tests__/DatasetReportRenderer.export-25873.test.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ function parseCsv(text: string): string[][] {
160160

161161
async function blobText(blob: Blob): Promise<string> {
162162
const text = await blob.text();
163-
return text.replace(/^/, '');
163+
return text.replace(/^\uFEFF/, '');
164164
}
165165

166166
describe('report export control (exportOptions, #25873)', () => {

0 commit comments

Comments
 (0)