[ZEPPELIN-6699] React remote CSV export omits the UTF-8 BOM that the Angular and classic paths write - #5466
Open
xhaktm00 wants to merge 1 commit into
Open
[ZEPPELIN-6699] React remote CSV export omits the UTF-8 BOM that the Angular and classic paths write#5466xhaktm00 wants to merge 1 commit into
xhaktm00 wants to merge 1 commit into
Conversation
The React remote builds its CSV by hand and hands the string straight to a Blob, with no BOM, so Excel reads it in the system code page and garbles non-ASCII data. The classic path prepends one through saveAsService, and the Angular path gets one from XLSX.writeFile(), so only this export was missing it. ZEPPELIN-672 added the BOM for exactly this reason. The xlsx branch is left alone since that format carries its own encoding.
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.
What is this PR for?
The React remote builds its CSV export by hand and hands the string straight to a
Blobwith no UTF-8 BOM, so Excel reads it in the system code page and garbles non-ASCII data. The classic path prepends one throughsaveAsService, and the Angular path gets one fromXLSX.writeFile(), so only this export was missing it. ZEPPELIN-672 added the BOM for exactly this reason.The xlsx branch is left alone, since that format carries its own encoding.
What type of PR is it?
Bug Fix
Todos
What is the Jira issue?
How should this be tested?
New spec
exportFile.spec.tsmocksfile-saverand inspects the bytes handed tosaveAs, sinceBlob.text()decodes and drops a leading BOM.Result:
Tests 1 failed | 67 passed (68). The one failure isHTMLRenderer.spec.tsx > highlights a code block, which fails the same way onorigin/masterwithout this change. Running the new spec alone passes:Reverting only the production change makes it fail with
expected [ 110, 97, 109 ] to deeply equal [ 239, 187, 191 ], so it does catch the defect.Manual: run a paragraph whose table result contains non-ASCII text, open the published paragraph with
?react=true, and choose "Export all data as csv". The file now starts withEF BB BFand opens in Excel with the text intact.Screenshots (if appropriate)
N/A
Questions:
Note: the issue scopes this to CSV and TSV, but the React remote has no TSV path, since
exportFile()only takes'csv' | 'xlsx'. I'll file that parity gap separately; the BOM sits on the shared branch, so a TSV path added there inherits it.