From owner-freebsd-python@FreeBSD.ORG Thu Jan 29 15:25:30 2015 Return-Path: Delivered-To: freebsd-python@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A4304229 for ; Thu, 29 Jan 2015 15:25:30 +0000 (UTC) Received: from mail-ie0-x22f.google.com (mail-ie0-x22f.google.com [IPv6:2607:f8b0:4001:c03::22f]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5ED35A46 for ; Thu, 29 Jan 2015 15:25:30 +0000 (UTC) Received: by mail-ie0-f175.google.com with SMTP id ar1so34971452iec.6 for ; Thu, 29 Jan 2015 07:25:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=rK6n7dGEgrYI9XULyqRv0QBwkt/uimeHa+y9wU3/364=; b=u0E5dqh03vi7NWDgrxuO1z57SB/Hu8EsU77YWeBJArZsdlfBah7avdIb16ITEKUrEb t2C+nE7eqx9iBiNHm3vuPHvYkJBV3m51OLpCwcRSPdxClsQAP1yxUmft69WRvF48OuMS 5OeFRAFRgVimgCgtXoYQ14/p888rCySNCpEw064Mk5i3eRJDeRBHYemPGxBzvUXIJva1 Xnp54MwNRhmDkDbNQ+k416dA0juSiTH3bAqarmKM0Y1KIPtLLNSzyeXwEbuJeYmoVG0W 6v5AlbdNAg/N41gi31LB3wmm1Kst4C9ySEJLleI/PPWqqk3yr9n6SJBmRa+C9xlZa5xC 0tWg== MIME-Version: 1.0 X-Received: by 10.42.199.211 with SMTP id et19mr1103398icb.9.1422545129593; Thu, 29 Jan 2015 07:25:29 -0800 (PST) Received: by 10.36.8.215 with HTTP; Thu, 29 Jan 2015 07:25:29 -0800 (PST) In-Reply-To: <20150129095328.GQ42409@kib.kiev.ua> References: <54C9FE33.2070307@FreeBSD.org> <20150129095328.GQ42409@kib.kiev.ua> Date: Thu, 29 Jan 2015 10:25:29 -0500 Message-ID: Subject: Re: Unicode Problem From: Robert Simmons To: freebsd-python@freebsd.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: freebsd-python@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: FreeBSD-specific Python issues List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jan 2015 15:25:30 -0000 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 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.