Skip to content

fix(office): decode redlining diffs as UTF-8 - #1765

Open
00200200 wants to merge 1 commit into
anthropics:mainfrom
00200200:fix/redlining-utf8-output
Open

00200200 wants to merge 1 commit into
anthropics:mainfrom
00200200:fix/redlining-utf8-output

Conversation

@00200200

@00200200 00200200 commented Sep 14, 2026 •

Copy link
Copy Markdown

Summary

  • decode git diff output as UTF-8 in the DOCX, PPTX, and XLSX redlining validators
  • keep the diff text intact for non-ASCII document content on Windows and other non-UTF-8 locales

Fixes #1707

Validation

For each of the three validators, I ran _get_git_word_diff() with Polish and Japanese text and confirmed the returned diff preserved 日本語. I also ran python3 -m compileall for the office validator modules and git diff --check.

@98zc5g5jyw-arch

Copy link
Copy Markdown

The encoding="utf-8" fix is correct — subprocess.run(text=True) decodes with the locale encoding, so non-ASCII redlining diffs blow up on non-UTF-8 locales (e.g. cp1252 on Windows). Good catch.

Process note: #1766 currently also carries these same redlining hunks (stacked PRs), and #1764 duplicates open PR #1734. Recommend rebasing so each PR contains only its own diff to keep review/merge clean. Thanks!

@00200200
00200200 force-pushed the fix/redlining-utf8-output branch from 1f67119 to 0f297bb Compare September 14, 2026 14:53
@00200200

Copy link
Copy Markdown
Author

Rebased this branch onto current main so it now contains only the UTF-8 decoding changes in the three redlining validators. The duplicated orphaned-comment hunk from #1764 is removed; current head is 0f297bb.

@98zc5g5jyw-arch

Copy link
Copy Markdown

Confirmed clean after rebase: the branch now contains only the three encoding="utf-8" additions (docx/pptx/xlsx redlining validators, both subprocess.run call sites each, +6 lines total). The fix is correct — with text=True and no explicit encoding, subprocess decodes stdout/stderr with the locale codec, so non-ASCII word-diff output crashes on non-UTF-8 locales (e.g. cp1252 on Windows). LGTM from the review side; nothing further needed here.

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.

docx/pptx/xlsx: redlining.py decodes git diff output with the locale codec — silent mojibake or None stdout on Windows

2 participants