fix: add bom to downloaded csv for excel #1430
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
If you download the result of a query as a CSV and then open the result in Excel, there are encoding issues for unicode/non-latin characters. This PR makes the process of opening a downloaded CSV in Excel a little smoother by adding the Byte Order Mark to the downloaded CSV. There is not a pressing issue with Querybook right now, Excel is just very particular and this makes the downloaded CSVs play nice with Excel's strange encoding import rules.
Example of Issue: Upload the following table and run
SELECT * FROM <your-schema>.non_latin_test
, then download the results of the query executionnon_latin_test.csv
Opening the result CSV in Excel used to give the following:
![image](https://private-user-images.githubusercontent.com/143662801/319359539-bf16cbc7-75f4-4ec1-b423-233ad6b436ae.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1ODQ0MzAsIm5iZiI6MTczOTU4NDEzMCwicGF0aCI6Ii8xNDM2NjI4MDEvMzE5MzU5NTM5LWJmMTZjYmM3LTc1ZjQtNGVjMS1iNDIzLTIzM2FkNmI0MzZhZS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjE1JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxNVQwMTQ4NTBaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1kYzhkYWZkNjJlYjVmOGVmODk5ZWYwNzA0ZDE4ODBhZjFhYmM0OWU1NjAyMDUzY2Y2ODk2MGYwNDU0ZDJjODdhJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.g8Tzi-GhtkkR5FixJEs4BFXfG2xgHZmLFQaU5vgHrcc)
This PR adds the BOM so that Excel is happy and gets the right encoding:
![image](https://private-user-images.githubusercontent.com/143662801/319360491-b1e72369-0bc5-4d3e-b0b0-0f9b8ac1a11c.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1ODQ0MzAsIm5iZiI6MTczOTU4NDEzMCwicGF0aCI6Ii8xNDM2NjI4MDEvMzE5MzYwNDkxLWIxZTcyMzY5LTBiYzUtNGQzZS1iMGIwLTBmOWI4YWMxYTExYy5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjE1JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxNVQwMTQ4NTBaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1kMTNlZGRlZDQxZGI0YzQ3YjIxODljNTg0MjQ3ZGI4NDg5MGEyY2NlMWVlZThhYzI4MDJjMTgwNjE3NTNjNjM2JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.1weEDCXqvRqmaCSPoKb9W095rHB286w7NLCL2n4NftU)