Skip to content

Conversation

@ThanhNguyxn
Copy link

Summary

Fixes #4765

On Windows with non-UTF8 console encodings (e.g., gbk for Chinese locale), Rich's console.print() can fail when printing Unicode characters like bullet points ( / U+2022) that aren't supported by the encoding.

Root Cause

The error occurs at mdstream.py line 207 when console.print(show) tries to output markdown content containing Unicode characters that can't be encoded with the console's encoding (gbk).

UnicodeEncodeError: 'gbk' codec can't encode character '\u2022' in position 1: illegal multibyte sequence

Fix

Added try/except around console.print() to catch UnicodeEncodeError and fall back to ASCII-safe text by replacing problematic characters with ?.

try:
    self.live.console.print(show)
except UnicodeEncodeError:
    safe_text = str(show).encode("ascii", errors="replace").decode("ascii")
    self.live.console.print(safe_text)

This ensures the application doesn't crash on Windows systems with non-UTF8 console encodings while still displaying readable output.

Fixes Aider-AI#4765

On Windows with non-UTF8 console encodings (e.g., gbk for Chinese locale),
Rich's console.print() can fail when printing Unicode characters like
bullet points (U+2022) that aren't supported by the encoding.

Added try/except around console.print() to catch UnicodeEncodeError and
fall back to ASCII-safe text by replacing problematic characters.
@e665107
Copy link

e665107 commented Jan 15, 2026

Hi , When i start the aider, it will pull the new file, and have a replace? Today is ok now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

win11 has encoding error!

2 participants