Skip to content

[htdocs] Update savecsv.js to save with utf-8 encoding #10378

@skarya22

Description

@skarya22

Describe the bug

  • When trying to Download a DataTable as CSV with special characters such as accents ('é', 'ô' etc.) it is not downloaded with the correct encoding so Excel reads the characters strangely
  • Since this is an issue in htdocs, projects cannot modify it so we need this change in Core instead.
  • The type of the Blob must be changed to text/csv;charset=utf-8; from text/csv
  • the content parameter in the Blob constructer must have \uFEFF appended to the start

To Reproduce

  • Insert a value in the datadict with an accent, or a user with an accent in their Full Name in User Accounts
  • Press Download Table as CSV and open in Excel
  • See strange characters instead of the accent

An example from the change on CCNA
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Project: CCNAIssue or PR related to the CCNA project

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions