fix(report): render em dash & non-ASCII names correctly in PDF reports#97
Conversation
gofpdf's core fonts render text as Windows-1252, so the UTF-8 em dash in the
"Skipped Repositories" empty-state line ("None — all targeted repositories
were analyzed.") appeared as the mojibake "None â€"…" in GlobalReport.pdf.
Install a UTF-8 translator (pdf.UnicodeTranslatorFromDescriptor) and route the
em-dash line, the skipped-repo table cells (repo/branch/reason), and the
organization subtitle through it, so those — plus any accented repository or
organization name — render correctly. Add a regression test asserting no raw
multi-byte UTF-8 sequence survives into the PDF content stream.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Apply the same gofpdf Windows-1252 translator to repository_summary.pdf so accented repository and branch names render correctly instead of as mojibake. Translation is applied before truncation so the byte-based length limit matches the rendered single-byte characters. Add a regression test asserting no raw multi-byte UTF-8 sequence survives into the content stream. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Address Gitar review on #97: the "Largest Repo" stat card in renderGlobalPDF drew ginfo.LargestRepository (a user-controlled repo name) without the UTF-8 translator, so an accented name still mojibaked in the summary card. Route the ginfo card values through tr() before valOrNA. Translating first also fixes valOrNA's byte-based truncation (s[:15]) splitting a multi-byte rune, since the string is single-byte Windows-1252 by then. Add an end-to-end regression test that renders the global PDF with an accented largest-repo name and asserts no raw UTF-8 survives into the decompressed content stream. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Code Review ✅ Approved 1 resolved / 1 findingsIntegrates gofpdf's UTF-8 translator into both global and repository PDF reports, resolving the mojibake rendering for em dashes and non-ASCII names. The previously identified issue with the Largest Repo stat card was also addressed as part of this fix. ✅ 1 resolved✅ Bug: Largest Repo stat card still mojibakes non-ASCII repo names
OptionsAuto-apply is off → Gitar will not commit updates to this branch. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Gitar |



Problem
The global PDF report showed mojibake in the Skipped Repositories empty-state line:
gofpdf's core fonts render text as Windows-1252, so the UTF-8 em dash (
—,E2 80 94) was emitted as raw bytes and decoded asâ€". The same class of bug affected any accented repository/organization name in both PDF reports.Fix
Install gofpdf's UTF-8 translator (
pdf.UnicodeTranslatorFromDescriptor("")) and route user-facing text through it:GlobalReport.pdf(globalreport.go)repository_summary.pdf(repository_summary.go)Translation happens before the column-fit / truncation width logic so those stay accurate on single-byte-encoded text.
Tests
TestRenderSkippedReposSection_NoMojibake— renders the skipped section (empty state + accentedcafé/naïve+ em dash) with compression disabled and asserts no raw multi-byte UTF-8 sequence (E2 80 94,C3 A9,C3 AF) survives into the PDF content stream.TestCreateRepositoryPDFRow_NoMojibake— same guard for a repository summary row with accented repo/branch names.All builds (
./...,-tags webui,-tags resultsall) and the full test suite pass.🤖 Generated with Claude Code