New submission from john_miller <johnson.b.ourne+pythonbugtrac...@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 <rep...@bugs.python.org>
<https://bugs.python.org/issue41821>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to