I am trying to print the Unicode Bitcoin symbol \\u2043
in Python 2. I have tried adding #-*- coding: utf-8 -*-
.
$ python2 -c \'pr
On Unix, if sys.stdout.isatty()
returns True
but sys.stdout.encoding
is 'ANSI_X3.4-1968'
(ascii) then you should configure your locale (check LANG
, LC_CTYPE
, LC_ALL
envvars) to use non-ascii encoding if you need to print non-ascii characters.
If sys.stdout.isatty()
is false then configure PYTHONIOENCODING
envvar outside your script.
Always print Unicode, don't hardcode the character encoding of your environment inside your script.