Skip to content

Commit

Permalink
Force UTF-8 encoding on unzipped CSV files (#4237)
Browse files Browse the repository at this point in the history
Co-authored-by: Tim Arney <timarney@users.noreply.github.com>
  • Loading branch information
dsamojlenko and timarney committed Sep 3, 2024
1 parent 8334792 commit a5cc3d4
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,11 @@ export const DownloadDialog = ({
}

downloadFormatEvent(formId, selectedFormat, ids.length);
const universalBOMForUTF8 = "\uFEFF";

if (zipAllFiles) {
const file = new JSZip();
const universalBOMForUTF8 = "\uFEFF";

file.file("receipt-recu.html", response.receipt);
file.file("responses-reponses.csv", universalBOMForUTF8 + response.responses);
file.generateAsync({ type: "nodebuffer", streamFiles: true }).then((buffer) => {
Expand All @@ -169,7 +170,7 @@ export const DownloadDialog = ({
} else {
downloadFileFromBlob(new Blob([response.receipt]), `${filePrefix}receipt-recu.html`);
downloadFileFromBlob(
new Blob([response.responses]),
new Blob([universalBOMForUTF8 + response.responses]),
`${filePrefix}responses-reponses.csv`
);

Expand Down

0 comments on commit a5cc3d4

Please sign in to comment.