Unicode Problem

Robert Simmons rsimmons0 at gmail.com
Thu Jan 29 15:25:30 UTC 2015


I appreciate the assistance. Setting the LANG variable does the trick.
I made the change system-wide by adding the following to
/etc/login.conf
LC_COLLATE=C
charset=UTF-8
lang=en_US.UTF-8

Now the output is correct:
>>> b'\xc3\xa2'.decode('utf-8')
'â'
>>> import sys
>>> print(sys.stdout.encoding)
UTF-8

On Thu, Jan 29, 2015 at 4:53 AM, Konstantin Belousov
<kostikbel at gmail.com> wrote:
> Encoding of the sys.stdout is determined by the language environment.
> Set LANG environment variable to something like en_US.UTF-8 to get
> UTF-8 output from python.


More information about the freebsd-python mailing list