Repository navigation
fix(csv): drop the UTF-8 BOM instead of keeping it in the first cell - #4098
Merged
Merged
Conversation
Contributor
|
✅ DCO Check Passed Thanks @aniketwaghh, all your commits are properly signed off. 🎉 |
Contributor
Merge Protections🟢 Merge protection satisfied — ready to merge. Show 1 satisfied protection🟢 Enforce conventional commitMake sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
|
CsvDocumentBackend decoded with plain utf-8, so a leading BOM survived into the first cell of the header row. Excel and Google Sheets both write one when exporting "CSV UTF-8", so the header came back as "Name" rather than "Name" and reached the exported document. The character is invisible, so the practical symptom is that anything matching on a header silently misses the first column with no visible cause. Decode with utf-8-sig, which strips a BOM when present and is equivalent to utf-8 when it is not, so files without one are unaffected. html_backend already strips as noise, so this brings CSV in line. The same plain-utf-8 decode exists in asciidoc, boxnote, webvtt and md, where a BOM only joins the first text run rather than corrupting a structured field, so those are left alone here. Fixes docling-project#4097 Signed-off-by: Aniket Wagh <waniket48@gmail.com>
aniketwaghh
force-pushed
the
fix-csv-utf8-bom
branch
from
August 28, 2026 13:47
af958ee to
538d2c3
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
cau-git
approved these changes
Aug 28, 2026
This was referenced Aug 29, 2026
Closed
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.
CsvDocumentBackenddecoded with plainutf-8, so a leading BOM ended up inside the first cell of the header row. Excel and Google Sheets both write one when exporting "CSV UTF-8".Decoding with
utf-8-sigstrips it when present and behaves exactly likeutf-8when it isn't, so files without a BOM are unaffected. I checked that across comma, semicolon and single-column inputs.html_backend.pyalready strips\ufeffas noise, so this just brings CSV in line.Issue resolved by this Pull Request:
Resolves #4097
Before and after
before
'\ufeffName', after'Name'. In the exported markdown that was:Since the character is invisible, the symptom users actually hit is a header match quietly failing on the first column.
Scope
Only CSV.
asciidoc_backend,boxnote_backend,webvtt_backendandmd_backenddecode the same way, but there a BOM just joins the first text run rather than corrupting a structured field, so I left them out rather than widen the diff. Happy to follow up separately if you want them covered.Testing
test_utf8_bom_is_not_part_of_the_first_cellcovers both the stream and the file path, since each decodes separately. It fails onmainand passes here. Written against an in-memoryDocumentStreamandtmp_pathrather than a new fixture, so it doesn't touchtests/data.The three existing CSV groundtruth tests pass unchanged, so no exported output moved.
make validateis clean.Checklist: