[issue41821] Printing specific Unicode characters causes unwanted beeping in Windows 7 console

john_miller report at bugs.python.org
Sun Sep 20 06:10:35 EDT 2020


New submission from john_miller <johnson.b.ourne+pythonbugtracker at gmail.com>:

I noticed some beeping when printing data to the console (cmd), so I narrowed down the problem to three specific Unicode-characters somehow producing beeps when printed to the Windows console (CMD). This also works in interactive mode. (I checked every single Unicode-character up to sys.maxunicode (except character-values between 0xD800 and 0xE000) by bisecting ever-more fine-grained until I narrowed it down to only those three characters producing unwanted beeps.)

Isolated example of bug: for i in ['\u2022', '\u2024', '\u2219']: print(i)

\u0007 beeps too, but this works as intended.

Python version: 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:43:08) [MSC v.1926 32 bit (Intel)]
Windows version: Microsoft Windows 7 Professional (6.1.7601 Service Pack 1 Build 7601)
CMD active code page: 850 (According to chcp-command.) 
sys.stdout.encoding: utf-8

Might be loosly related to PEP-528 (https://www.python.org/dev/peps/pep-0528/)

Addendum:
Piping the output like: 'python.exe script.py >> testfile.txt' produced an error.
This might happen with more Unicode characters but I haven't checked.

Addendum-Example:
Traceback (most recent call last):
  File "pytest2.py", line 38, in <module>
    print(hex(i), ":", chr(i), end='\n')
  File "C:\Python38-32\lib\encodings\cp1252.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\u2023' in position 0: character maps to <undefined>

----------
components: Unicode, Windows
messages: 377214
nosy: ezio.melotti, john_miller, paul.moore, steve.dower, tim.golden, vstinner, zach.ware
priority: normal
severity: normal
status: open
title: Printing specific Unicode characters causes unwanted beeping in Windows 7 console
type: behavior
versions: Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41821>
_______________________________________


More information about the Python-bugs-list mailing list