forked from Archives/langchain
add encoding to avoid UnicodeDecodeError (#2908)
**About** Specify encoding to avoid UnicodeDecodeError when reading .txt for users who are following the tutorial. **Reference** ``` return codecs.charmap_decode(input,self.errors,decoding_table)[0] UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 1205: character maps to <undefined> ``` **Environment** OS: Win 11 Python: 3.8
This commit is contained in:
parent
392f1b3218
commit
13a0ed064b
@ -99,7 +99,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"from langchain.document_loaders import TextLoader\n",
|
"from langchain.document_loaders import TextLoader\n",
|
||||||
"loader = TextLoader('../state_of_the_union.txt')"
|
"loader = TextLoader('../state_of_the_union.txt', encoding='utf8')"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user