Skip to content

Preserve original Unicode text on request - #35

Draft
vanderlee wants to merge 8 commits into
agent/modernize-test-matrixfrom
agent/preserve-original-text
Draft

Preserve original Unicode text on request#35
vanderlee wants to merge 8 commits into
agent/modernize-test-matrixfrom
agent/preserve-original-text

Conversation

@vanderlee

@vanderlee vanderlee commented Aug 3, 2026

Copy link
Copy Markdown
Owner

What changed

  • Add Sentence::SPLIT_PRESERVE as a backward-compatible opt-in flag.
  • Use normalized text only for boundary detection, then project sentence boundaries back onto the original Unicode input.
  • Use explicit UTF-8 offsets so preservation behaves consistently on PHP 5.4 and later.
  • Allow combining preservation with SPLIT_TRIM.
  • Add smart-apostrophe regressions and document the new flag.

Why

The splitter currently normalizes curly quotes and apostrophes before returning sentences. That makes returned text differ from the input and prevents callers from locating sentence substrings in the original source.

The default behavior remains unchanged. Preservation is explicit because existing callers may depend on normalized output.

Validation

The patch workflow passed the Composer test suite on PHP 8.4 and then again on PHP 5.4 with explicit UTF-8 offsets. The branch is stacked on PR #30, whose PHP 5.4–8.5 matrix is green.

Closes #24.

@vanderlee
vanderlee changed the base branch from agent/modernize-test-matrix to master August 3, 2026 06:56
@vanderlee vanderlee closed this Aug 3, 2026
@vanderlee vanderlee reopened this Aug 3, 2026
@vanderlee vanderlee closed this Aug 3, 2026
@vanderlee vanderlee reopened this Aug 3, 2026
@vanderlee
vanderlee changed the base branch from master to agent/modernize-test-matrix August 3, 2026 07:06
@vanderlee vanderlee closed this Aug 3, 2026
@vanderlee vanderlee reopened this Aug 3, 2026
@vanderlee
vanderlee changed the base branch from agent/modernize-test-matrix to master August 3, 2026 07:11
@vanderlee vanderlee closed this Aug 3, 2026
@vanderlee vanderlee reopened this Aug 3, 2026
@vanderlee
vanderlee changed the base branch from master to agent/modernize-test-matrix August 3, 2026 07:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

encoding issue: not a blocker but something to be aware of for fellow users

1 participant