[MPDX-8418] Add UTF-8 BOM to CSV exports #1173
Merged
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
Excel does not interpret UTF-8 encoded CSV files correctly. For example, exports contain characters like this instead of Russian characters:
"–ï–¥–∞/–ø–æ–¥–∞—Ä–∫–∏ –¥–ª—è –≤—Å—Ç—Ä–µ—á –£–∂–∏–Ω –° –∫–æ–º–∞–Ω–¥–æ–π –∏ —Å —Å—Ç—É–¥–µ–Ω—Ç–∞–º–∏"
. To fix this, we need to add the Byte Order Mark to hint to Excel that it needs to interpret the file as UTF-8 instead of as ASCII. Fortunately,react-csv
has an option for this. We just have to passtrue
as the second argument tobuildURI
.I also migrated the account transactions CSV download from a handrolled CSV export to use
react-csv
.Note that the API already adds the byte order mark to server-generated CSV exports.
Testing
MPDX-8418
Checklist: