@devries-cameron20 / t3code Mirror · read-only / commits / 18f154a2c1
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 07:15 UTC

fix(server): decode Mac Roman in RTF attachments (#38645)

Co-authored-by: Simone <185146821+Lucenx9@users.noreply.github.com> Co-authored-by: Julius Marminge <julius0216@outlook.com>

Simone committed Nov 18, 2026 at 21:11 UTC 18f154a2c18b31cc335e33c854ea6ff1641a59ea
2 files changed +9 -1
apps/server/src/provider/documentTextWorker.ts
+3 -1
@@ -487,7 +487,9 @@ function* rtf(source: string): Generator<string, void> {
487 state.skip = true;
488 if (control === "deleted") state.deleted = value !== 0;
489 else if (control === "plain") state.deleted = false;
490 - if (control === "ansicpg") {
490 + if (control === "mac" || (control === "ansicpg" && value === 10000))
491 + state.decoder = new TextDecoder("macintosh");
492 + else if (control === "ansicpg") {
493 // Per-byte decoding only supports single-byte Windows code pages.
494 if (value !== 874 && (value < 1250 || value > 1258))
495 throw new Error("Unsupported RTF code page");
apps/server/src/provider/userInputAttachments.test.ts
+6
@@ -338,6 +338,12 @@ describe("question answer paths", () => {
338 ["group open", String.raw`{\rtf1\ansi\u945{Z}}`, "αZ"],
339 ["hex byte", String.raw`{\rtf1\ansi\u945\'3fZ}`, "αZ"],
340 ["escaped symbol", String.raw`{\rtf1\ansi\u945\{Z}`, "αZ"],
341 + ["Macintosh text", String.raw`{\rtf1\mac Caf\'8e Cr\'8fme}`, "Café Crème"],
342 + [
343 + "explicit Macintosh code page",
344 + String.raw`{\rtf1\mac\ansicpg10000 Caf\'8e Cr\'8fme}`,
345 + "Café Crème",
346 + ],
347 ["destination symbol", String.raw`{\rtf1\ansi\u945\*Z}`, "αZ"],
348 ["multiple units", String.raw`{\rtf1\ansi\uc4\u945?\tab\'3f\~Z}`, "αZ"],
349 ["binary unit", String.raw`{\rtf1\ansi\u945\bin3 abcZ}`, "αZ"],