UnicodeDecodeError Charmap Codec Can't Decode Byte in Python Langchain TextLoader While Opening File.
UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 11921: character maps to undefined
Solution:- and 'utf-8' encoding if the file is encoded in utf-8
from langchain.document_loaders import TextLoader
loader = TextLoader("./data.txt", encoding='utf-8')
document = loader.load()
#python #pythonprogramming #python3 #langchain