A community-supported supercharged document management system: scan, index and archive all your documents
Python aiangulararchivingdjangodmsdocument-managementdocument-management-systemllmmachine-learningocroptical-character-recognitionpdf
Changes the error mode to replace instead of ignore, to better highlight where a problem happened
Trenton Holmes3205d52331c1
diff --git a/src/documents/parsers.py b/src/documents/parsers.pyindex cb9b31cfd..93d78832e 100644--- a/src/documents/parsers.py+++ b/src/documents/parsers.py@@ -329,7 +329,7 @@ class DocumentParser(LoggingMixin):text = filepath.read_text(encoding="utf-8")except UnicodeDecodeError as e:self.log("warning", f"Unicode error during text reading, continuing: {e}")- text = filepath.read_bytes().decode("utf-8", errors="ignore")+ text = filepath.read_bytes().decode("utf-8", errors="replace")return textdef extract_metadata(self, document_path, mime_type):diff --git a/src/paperless_text/tests/test_parser.py b/src/paperless_text/tests/test_parser.pyindex b6b331fce..cc5ce76fe 100644--- a/src/paperless_text/tests/test_parser.py+++ b/src/paperless_text/tests/test_parser.py@@ -48,5 +48,5 @@ class TestTextParser(DirectoriesMixin, FileSystemAssertsMixin, TestCase):"text/plain",)- self.assertEqual(parser.get_text(), "Pantothensure\n")+ self.assertEqual(parser.get_text(), "Pantothens�ure\n")self.assertIsNone(parser.get_archive_path())