mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-24 22:34:59 +00:00
Improved error handling in Aider to safely encode and decode text containing emojis or other problematic characters.
This commit is contained in:
parent
1a345a4036
commit
9a7c67966a
1 changed files with 6 additions and 1 deletions
|
@ -1233,7 +1233,12 @@ class Coder:
|
|||
if self.show_pretty():
|
||||
self.live_incremental_response(False)
|
||||
elif text:
|
||||
sys.stdout.write(text)
|
||||
try:
|
||||
sys.stdout.write(text)
|
||||
except UnicodeEncodeError:
|
||||
# Safely encode and decode the text
|
||||
safe_text = text.encode(sys.stdout.encoding, errors='backslashreplace').decode(sys.stdout.encoding)
|
||||
sys.stdout.write(safe_text)
|
||||
sys.stdout.flush()
|
||||
yield text
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue