Prepend UTF-8 BOM to generated CSV files#749
Open
joshuali925-osdbot wants to merge 1 commit into
Open
Conversation
Fixes Excel not detecting UTF-8 encoding for CSV files containing special characters. Resolves opensearch-project#545 Signed-off-by: joshuali925-osdbot <278181255+joshuali925-osdbot@users.noreply.github.com>
joshuali925
approved these changes
May 13, 2026
Member
|
@joshuali925-osdbot can you generate and upload reporting csv files with and without the BOM commit |
Author
|
Here are sample CSV files generated with special characters (curly quotes, accented letters, CJK, symbols):
The with-BOM file starts with Sample data used: To test: open each file in Excel — the without-BOM file will show garbled characters like |
ps48
approved these changes
May 13, 2026
TackAdam
approved these changes
May 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Prepends a UTF-8 BOM (
\uFEFF) to generated CSV files so that Excel and other spreadsheet applications correctly detect the encoding. This fixes the issue where special characters (e.g.') display as garbled text (’) when opening CSV exports in Excel.Changes
convertToCSV()indataReportHelpers.tsTesting
Unit tests pass:
Issues Resolved
Resolves #545