mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-30 17:24:59 +00:00
fix: handle UnicodeEncodeError in console output with ASCII fallback
This commit is contained in:
parent
c5919f0c15
commit
44d36f140a
1 changed files with 8 additions and 3 deletions
11
aider/io.py
11
aider/io.py
|
@ -804,9 +804,14 @@ class InputOutput:
|
|||
hist = message.strip() if strip else message
|
||||
self.append_chat_history(hist, linebreak=True, blockquote=True)
|
||||
|
||||
message = Text(message)
|
||||
style = dict(style=color) if self.pretty and color else dict()
|
||||
self.console.print(message, **style)
|
||||
try:
|
||||
message = Text(message)
|
||||
style = dict(style=color) if self.pretty and color else dict()
|
||||
self.console.print(message, **style)
|
||||
except UnicodeEncodeError:
|
||||
# Fallback to ASCII-safe output
|
||||
message = message.encode('ascii', errors='replace').decode('ascii')
|
||||
self.console.print(message, **style)
|
||||
|
||||
def tool_error(self, message="", strip=True):
|
||||
self.num_error_outputs += 1
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue