Skip to content

Saving run text that contains a lone (unpaired) surrogate throws in TsString normalization #412

Open

Description

@johnml1135

A run whose text contains an unpaired UTF-16 surrogate cannot be saved: TsString.get_NormalizedForm throws (via EnumerateSegmentLimits → char.ConvertToUtf32) before the serializer runs. Pasted or imported text can carry such characters.

Found while working on #410, which strips unpaired surrogates from string properties (TsStringSerializer.GetXmlSafeText) but cannot reach this path.

Repro: create a TsString with text "a\uD800b" and serialize it with TsStringSerializer.

Suggested fix: make normalization tolerate unpaired surrogates (pass them through or replace with U+FFFD) and strip them on write as #410 does for string properties; add a test.

🤖 Generated with Claude Code

Activity

  1. added a commit that references this issue on Nov 5, 2026
    db81dfc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions