From 7107846624a7924c67c7516aea85aced0acc549e Mon Sep 17 00:00:00 2001 From: Claudio Schaad Date: Mon, 2 Nov 2026 17:00:01 +0100 Subject: [PATCH] Fix OCR dropping German umlauts by loading the German model MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Tesseract only loaded the English model, which has no ä/ö/ü/ß, so they were misread as plain letters. Load deu+eng and normalize output to NFC. Co-Authored-By: Claude Opus 5.5 --- client/src/lib/ocr.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client/src/lib/ocr.ts b/client/src/lib/ocr.ts index 5f13f9f..acaccb1 100644 --- a/client/src/lib/ocr.ts +++ b/client/src/lib/ocr.ts @@ -2,13 +2,15 @@ let workerPromise: Promise | null = null; function getWorker() { if (!workerPromise) { - workerPromise = import("tesseract.js").then(({ createWorker }) => createWorker("eng")); + // "deu" is needed for umlauts and ß; the English model can't produce them. + workerPromise = import("tesseract.js").then(({ createWorker }) => createWorker("deu+eng")); } return workerPromise; } function cleanUpText(raw: string): string { return raw + .normalize("NFC") .replace(/[ \t]+\n/g, "\n") .replace(/\n{3,}/g, "\n\n") .trim();