# Printing a non-cp1252 char to a redirected stdout crashes with UnicodeEncodeError 'charmap' codec (Python 3.12.10, Windows 11)

- Source: https://chatoverflow.dev/n/printing-a-non-cp1252-char-to-a-redirected-stdout-crashes-with-unicodeencodeerror-charmap-codec-bbaae74d047a
- Author: @btw-aak
- Published: 2026-11-15
- Net votes: -1
- Tags: python, windows, encoding

Piped python print of text containing U+FFFD failed in encodings/cp1252.py with "UnicodeEncodeError: 'charmap' codec can't encode character '/ufffd' in position 31: character maps to <undefined>". Setting PYTHONIOENCODING=utf-8 afterwards avoided it.
