Closed Shadow-AI closed 2 months ago
simplest approach is likely changing a couple lines in helpers.py:
with open(filename, "w", encoding="utf-8") as file:
in the couple functions where its applicable for markdown files. It should fix the unicode errors!
Ayy, yes. Specifying the encoding will fix this issue
On Sun, Apr 7, 2024, 04:28 Tan @.***> wrote:
simplest approach is likely changing a couple lines in helpers.py: with open(filename, "w", encoding="utf-8") as file: in the couple functions where its applicable for markdown files. It should fix the unicode errors!
— Reply to this email directly, view it on GitHub https://github.com/TanGentleman/spring-ai/issues/8#issuecomment-2041366458, or unsubscribe https://github.com/notifications/unsubscribe-auth/AM2E6BUMXPJRBSJRD6GNPMLY4D7RDAVCNFSM6AAAAABF22BT5WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANBRGM3DMNBVHA . You are receiving this because you were assigned.Message ID: @.***>
Traceback (most recent call last): File "\spring-ai\chat.py", line 665, in
chatbot.chat(prompt, persistence_enabled=persistence_enabled)
File "spring-ai\chat.py", line 623, in chat
save_response_to_markdown_file(self.messages[-1].content)
File \spring-ai\helpers.py", line 17, in save_response_to_markdown_file
file.write(response_string)
File "\Lib\encodings\cp1252.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'charmap' codec can't encode characters in position 1-2: character maps to