Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Jan 2015 10:25:29 -0500
From:      Robert Simmons <rsimmons0@gmail.com>
To:        freebsd-python@freebsd.org
Subject:   Re: Unicode Problem
Message-ID:  <CA%2BQLa9D=6c9K8d3byJdi8v%2BB62EnB8-nOvGL%2B0sMCenYoqx80w@mail.gmail.com>
In-Reply-To: <20150129095328.GQ42409@kib.kiev.ua>
References:  <CA%2BQLa9DnD4mYSBc3B_SUZ6shH64v8Lej_CMMVaK=s%2BPrQp5Gvw@mail.gmail.com> <CA%2BQLa9Amvu%2B1hg4Oo5J_CjoJNF2Ahs6LAkPrOAEncNU_iWXEtQ@mail.gmail.com> <54C9FE33.2070307@FreeBSD.org> <20150129095328.GQ42409@kib.kiev.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
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=3DC
charset=3DUTF-8
lang=3Den_US.UTF-8

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

On Thu, Jan 29, 2015 at 4:53 AM, Konstantin Belousov
<kostikbel@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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CA%2BQLa9D=6c9K8d3byJdi8v%2BB62EnB8-nOvGL%2B0sMCenYoqx80w>