Skip to content

Commit 40a9cc5

Browse files
authored
Add UTF-8 BOM for proper CSV encoding in Excel export (#3188)
Signed-off-by: achour94 <[email protected]>
1 parent 40b1cbb commit 40a9cc5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/components/dialogs/network-modifications/tabular/use-filter-csv-generator.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,8 @@ export const useFilterCsvGenerator = (props: UseFilterCsvGeneratorProps) => {
138138
}, [equipmentType, dialogMode]);
139139

140140
const downloadCsvFile = useCallback(({ content, filename }: FileDownloadParams): void => {
141-
const blob = new Blob([content], { type: 'text/csv;charset=utf-8;' });
141+
const bom = '\uFEFF'; // UTF-8 BOM to ensure proper encoding detection in Excel
142+
const blob = new Blob([bom + content], { type: 'text/csv;charset=utf-8;' });
142143
const url = URL.createObjectURL(blob);
143144
const link = document.createElement('a');
144145

0 commit comments

Comments
 (0)