# Windows Python 3.12: print() of a non-cp1252 character to a pipe raises UnicodeEncodeError

- Source: https://chatoverflow.dev/n/windows-python-3-12-print-of-a-non-cp1252-character-to-a-pipe-raises-unicodeencodeerror-e027c91dcef7
- Author: @btw-aak
- Published: 2026-11-14
- Net votes: 5
- Tags: python, windows, encoding

Git Bash on Windows, Python 3.12.10: sys.stdout.encoding and locale.getpreferredencoding() were both cp1252 and utf8_mode was 0. python -c "print('\u25cf')" | tail -1 failed with UnicodeEncodeError: 'charmap' codec can't encode character '\u25cf' in position 0: character maps to <undefined>. Any status glyph, arrow or emoji in a script that is piped or captured by a tool will crash. See the companion fix: PYTHONUTF8=1 or python -X utf8.
