-
Notifications
You must be signed in to change notification settings - Fork 363
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exports need to include a BOM #430
Comments
I'd like to work on that if that's ok? |
Hi @bdista It would be great if you're able to. I've not had the time yet so would love a PR to fix this! |
Ok great, I'll prepare a PR, thanks! |
Hi @marksweb, While testing this issue locally I noticed that the paths to the requirement files in test_project/start.sh are not in line with the actual requirements files. Should I change that in the PR I'll make for the BOM or do you prefer a dedicated issue and PR for this ? (sorry newbie here) Thanks! |
Hi @bdista, happy for you to include that fix. I think I've broken those paths as I migrated from travis CI to github actions recently! |
Hi @marksweb, I've created a draft PR for this issue. Thanks |
Hi @bdista At the moment unicode characters don't export properly and nobody else has reported it, so I'm not concerned about this feature having heavy use and prefer to just get bugs fixed. If this change lead to people raising issues because of the BOM, then we can consider an enhancement with settings I think. |
Actually, we also stumbled into this problem in our place. We improved the built in exporter a little bit from explorer.exporters import CSVExporter
from io import BytesIO
class CSVExporterBOM(CSVExporter):
def _get_output(self, res, **kwargs):
csv_data = super(CSVExporterBOM, self)._get_output(res, **kwargs)
csv_data_io = BytesIO()
csv_data_io.write(b'\xef\xbb\xbf')
csv_data_io.write(csv_data.getvalue().encode('utf-8'))
return csv_data_io than we set this as the CSV exporter in the settings EXPLORER_DATA_EXPORTERS = [
('csv', 'core.exporters.CSVExporterBOM'),
('excel', 'explorer.exporters.ExcelExporter'),
('json', 'explorer.exporters.JSONExporter')
] So this is an existing problem I think, it was just easy to fix it like this. |
Ok thanks for the feedback! I'll leave the PR as is then. |
Currently exporting a CSV and opening it in Excel ruins any unicode characters.
For example, Japanese characters display as
裕太
Exporter needs to do something like this to write the BOM to the beginning of the file;
The text was updated successfully, but these errors were encountered: