When printing in terminal, additional REPLACEMENT CHARACTER “�” (U+FFFD) appears

Viewed 233

I'm seeing weird extra glyphs while printing unicode

$ python3
Python 3.6.7 (default, Dec  5 2018, 15:01:38)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-28)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> print("\N{snake}")
�

This is what it looks like in the terminal:

cap

The unwanted character appears to be REPLACEMENT CHARACTER, ord 0xfffd.

>>> import locale, sys, os
>>> sys.stdout.encoding
'UTF-8'
>>> locale.getdefaultlocale()
('en_US', 'UTF-8')
>>> os.environ["LANG"]
'en_US.UTF-8'
>>> sys.getdefaultencoding()
'utf-8'

What can cause that and how to fix it? Any other details you'd like provided let me know in comments and I'll edit them in.

0 Answers
Related