Skip to content

fix(statusline): force UTF-8 stdout so it doesn't crash on non-UTF-8 symbols#2

Open
pochetnyi-vasilyi wants to merge 1 commit into
DefaultPerson:masterfrom
pochetnyi-vasilyi:master
Open

fix(statusline): force UTF-8 stdout so it doesn't crash on non-UTF-8 symbols#2
pochetnyi-vasilyi wants to merge 1 commit into
DefaultPerson:masterfrom
pochetnyi-vasilyi:master

Conversation

@pochetnyi-vasilyi

Copy link
Copy Markdown
Contributor

Force UTF-8 stdout so it doesn't crash on non-UTF-8 consoles

The accent rail (U+258C), arrow separator (U+203A) and warning glyph (U+26A0) are non-ASCII. On consoles whose default encoding isn't UTF-8 (e.g. Windows cp1251) print() raised UnicodeEncodeError and the status line failed to render at all. Reconfigure stdout to UTF-8 with errors='replace' at startup so the glyphs print on every platform.

Also write the DEBUG_STATUSLINE dump to the OS temp dir via tempfile.gettempdir() instead of the Unix-only /tmp path, which does not exist on native Windows.

…consoles

The accent rail (U+258C), arrow separator (U+203A) and warning glyph
(U+26A0) are non-ASCII. On consoles whose default encoding isn't UTF-8
(e.g. Windows cp1251) print() raised UnicodeEncodeError and the status
line failed to render at all. Reconfigure stdout to UTF-8 with
errors='replace' at startup so the glyphs print on every platform.

Also write the DEBUG_STATUSLINE dump to the OS temp dir via
tempfile.gettempdir() instead of the Unix-only /tmp path, which does
not exist on native Windows.
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.

1 participant