fix(pdf): normalize Arabic presentation forms (RTL phase 1) - #2539
Open
Islam El-Nashar (aslamalkarywk7) wants to merge 1 commit into
Open
Islam El-Nashar (aslamalkarywk7) wants to merge 1 commit into
Islam El-Nashar (aslamalkarywk7) wants to merge 1 commit into
Conversation
Author
|
@microsoft-github-policy-service agree |
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.
Related to #2336 (Phase 1 of the plan proposed there).
Some PDF producers emit Arabic Presentation Forms (U+FB50-U+FDFF, U+FE70-U+FEFF) instead of standard letters, which breaks downstream matching and LLM extraction. PdfConverter now normalizes exactly those two ranges to standard Unicode (NFKC per character, so ligatures expand too); everything else passes through byte-identical. Applied as a post-processing stage next to the existing numbering merge, so all extraction paths are covered.
Out of scope for this phase (stated openly): full BiDi reading-order reconstruction and RTL table column handling need the reporter redacted fixtures offered in the issue (or a new bidi dependency) — proposed as Phase 2 once fixtures land.
Verification: new tests/test_pdf_rtl.py (5 tests, fixtures use explicit escapes so they are encoding-proof) pass; existing pdf suites (masterformat, tables: 27 tests) pass unchanged.