From ed829ddfe35bddde2de261a291a2e487cb165a81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Mu=C3=B1oz=20Molina?= Date: Mon, 18 Nov 2024 17:42:58 +0100 Subject: [PATCH] Put the addition of the encoding in an empty constructor --- .../Connectors/DocDocumentConnector.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Encamina.Enmarcha.SemanticKernel.Connectors.Document/Connectors/DocDocumentConnector.cs b/src/Encamina.Enmarcha.SemanticKernel.Connectors.Document/Connectors/DocDocumentConnector.cs index 616a8dd..fe2db97 100644 --- a/src/Encamina.Enmarcha.SemanticKernel.Connectors.Document/Connectors/DocDocumentConnector.cs +++ b/src/Encamina.Enmarcha.SemanticKernel.Connectors.Document/Connectors/DocDocumentConnector.cs @@ -12,6 +12,15 @@ namespace Encamina.Enmarcha.SemanticKernel.Connectors.Document.Connectors; /// public class DocDocumentConnector : IEnmarchaDocumentConnector { + /// + /// Initializes a new instance of the class. + /// + public DocDocumentConnector() + { + // Register the code pages encoding provider for the .doc files + Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); + } + /// public IReadOnlyList CompatibleFileFormats => [".DOC"]; @@ -20,9 +29,6 @@ public virtual string ReadText(Stream stream) { Guard.IsNotNull(stream); - // Register the code pages encoding provider for the .doc files - Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); - var document = new HWPFDocument(stream); var extractor = new WordExtractor(document);