docstr: Test if the encoding metadata field is used properly
docstr_tok: ["Test","if","the","encoding","metadata","field","is","used","properly"]
code: def test_encoding_override(self, test_files_path):
      """
      Test if the encoding metadata field is used properly
      """
      bytestream = ByteStream.from_file_path(
          test_files_path / "txt" / "doc_1.txt"
      )
      bytestream.meta["key"] = "value"
  
      converter = TextFileToDocument(encoding="utf-16")
      output = converter.run(sources=[bytestream])
      assert (
          "Some text for testing." not in output["documents"][0].content
      )
  
      bytestream.meta["encoding"] = "utf-8"
      output = converter.run(sources=[bytestream])
      assert "Some text for testing." in output["documents"][0].content
  
file_path: haystack/test/components/converters/test_textfile_to_document.py
imports: import logging
  from unittest.mock import patch
  from pathlib import Path
  import pytest
  from haystack.dataclasses import ByteStream
  from haystack.components.converters.txt import TextFileToDocument
label_desc: Use image node_id 3 for calling the TestTextfileToDocument obj's underlying member method code with example usage: obj.test_encoding_override(test_files_path) without return types