Skip to content

Unicode \u202f breaks the next pages of template #627

Open

Description

@fathurwithyou

Describe the bug

I recently develop auto document generation using gpt-oss:20b model. Unexpectedly, the model gives output like 5\u202fseconds and this results a bug to the template where all next pages disappeared.

Expected behavior

I think we should normalize the problematic unicode before rendering.

Screenshots

Image Image Image

Activity

  1. CAOShurong commented on Aug 13, 2026

    @CAOShurong

    I could not reproduce this yet against a wheel built from current master (1f143fbe86c19ecb28c3205d5f4b1547c7e2d7ad).

    I created a two-page DOCX template with the value on page 1 and a fixed SECOND_PAGE_MARKER after an explicit page break. I tested both forms that the report might mean:

    • an actual U+202F character: "5\u202fseconds"
    • the six literal characters: r"5\u202fseconds"

    After rendering, both output packages reopened successfully with python-docx; both retained all three paragraphs (value, page-break paragraph, second-page marker), and the marker remained in word/document.xml. The outputs were 36,683 and 36,681 bytes respectively. I did not render them through Microsoft Word, so this does not rule out a layout interaction in the original template.

    Could you attach a minimal source template plus the broken rendered output, and show repr(the_value_passed_to_render)? That would distinguish an actual U+202F code point from an escaped string and let us test the specific page/section XML that disappears.

    OpenAI Codex assisted with the reproduction script and package inspection; I verified the run and results before posting.

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions