Skip to content

Commit

Permalink
fix: add bom to downloaded csv
Browse files Browse the repository at this point in the history
  • Loading branch information
rchandnaeg committed Apr 3, 2024
1 parent a6f73fc commit f8f069e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion querybook/server/datasources/query_execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,12 @@ def download_statement_execution_result(statement_execution_id):
# We read the raw file and download it for the user
reader.start()
raw = reader.read_raw()
response = Response(raw)

# Add Byte-Order-Mark to the utf8 file to make Excel happy
raw_bytes = raw.encode() # get bytes instead of string
BOM = b'\xEF\xBB\xBF'
raw_with_bom = BOM + raw_bytes
response = Response(raw_with_bom)
response.headers["Content-Type"] = "text/csv"
response.headers[
"Content-Disposition"
Expand Down

0 comments on commit f8f069e

Please sign in to comment.