Sao exports with accents

Hi,

I recently received a request from an user that is using the CSV functionality to export data from the system, he is running on windows and when opening the file with accents this are not correctly rendered on excel:

imatge

The text should be Categorías and Joyería.

After some digging I’ve seen that the file is generated as UTF-8 (this is because PapaParse does not support encoding on export) but we set the encoding as CP1252.

I’m wondering how we should improve this. Any Ideas?

I guess we could set encoding to UTF-8 by default on export (no for import) but if I remember correctly Excel does not detect the encoding and always use the default system. That’s why on tryton we set CP1252 as default for Windows (and copied the behavior in sao).
So I think as Papa.unparse returns a string, we could use TextEncoder.encode if available to encode in CP1252.

I have made some experiment and TextEncoder support only utf-8 in latest version so it is not an option.
Also the problem comes from the browsers that do not respect the charset we define in the type of Blob. I found references about such defunct.
So I think the proper solution would be that the web client export only in utf-8 (as it is the web standard) and that we add the utf-8 BOM on Windows platform as suggested by https://softwareengineering.stackexchange.com/a/372693.

Implemented in Issue 9527: Always export CSV encoded in UTF-8 - Tryton issue tracker