question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Exports need to include a BOM

See original GitHub issue

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;

    contents = StringIO()
    contents.write(codecs.BOM_UTF8.decode('utf-8'))
    writer = csv.writer(contents)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
legios89commented, May 14, 2021

Actually, we also stumbled into this problem in our place. What we did is the following

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.

1reaction
bdistacommented, May 12, 2021

Ok great, I’ll prepare a PR, thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Exporting BOMs - 2019 - SOLIDWORKS Help
Right-click a BOM and click Save As. In the dialog box: In Save as type, select a file type. Browse to a folder,...
Read more >
Export Data - OpenBOM Training Library
OpenBOM provides a comprehensive set of options to export data from OpenBOM. It includes exporting tables in multiple formats as well as using...
Read more >
Exporting your SOLIDWORKS BOM and creating items in your ...
https://www.customtools.info/ ← Get FREE 30-day trial!Ready with your project, make sure that BOMs and items are created or updated into ...
Read more >
Export Assembly BOM as an Excel File in SolidWorks 3D CAD
There will be cases when you would want to share the Bill of Materials with someone who doesn't have access to SolidWorks, in...
Read more >
Exporting and Importing Bill of Materials (BOM)
Link to How to Export and Import Bill of Materials (BOM). Ensure you have created all Products required to create the Bill of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found