From owner-freebsd-python@FreeBSD.ORG Thu Jan 29 09:32:45 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 126BDAA3 for ; Thu, 29 Jan 2015 09:32:45 +0000 (UTC) Received: from mail-pa0-x233.google.com (mail-pa0-x233.google.com [IPv6:2607:f8b0:400e:c03::233]) (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 CFF20C6F for ; Thu, 29 Jan 2015 09:32:44 +0000 (UTC) Received: by mail-pa0-f51.google.com with SMTP id fb1so37002788pad.10 for ; Thu, 29 Jan 2015 01:32:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:reply-to:user-agent:mime-version:to:cc :subject:references:in-reply-to:content-type :content-transfer-encoding; bh=QFBdz2LTAg/pC8VOMgQSV2pyXqCF08eplZTsU6YYTxk=; b=UNo003iijEOsvWvq+sJRhb7otYuRq2iSfYK5bzrV8Y5IR+4PqlWnDsPQSBwUpTPynl gmFb3voOMbIooj9PVfb0Nuvcc1AT/MDcnABQJOMb6kf3+YsJDFn9HW007IDFt4S/tAtV m6QwqFD/ZvkIqBQO4m+svXbmUtknGSFyb7yl7hfQaCCPd3go+49k+63lz/NzW0KdjVac sKl5fb9OQ9qP8oAopOpsAqdyYxTWGtcnrBMZIXcpokiG5K3Cv+c9ZMGdWpP+pynSGenX FW0OpChbXb1Ikkj4hN4QA5hbyrrPeObKwSg5Ji1aUJeg6aU8dniLzWhjz7ULE23sBY4v nAQw== X-Received: by 10.68.231.71 with SMTP id te7mr12613363pbc.129.1422523964343; Thu, 29 Jan 2015 01:32:44 -0800 (PST) Received: from [192.168.1.107] (ppp59-167-128-11.static.internode.on.net. [59.167.128.11]) by mx.google.com with ESMTPSA id gx1sm7141684pbd.57.2015.01.29.01.32.42 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Jan 2015 01:32:43 -0800 (PST) Sender: Kubilay Kocak Message-ID: <54C9FE33.2070307@FreeBSD.org> Date: Thu, 29 Jan 2015 20:32:35 +1100 From: Kubilay Kocak Reply-To: koobs@FreeBSD.org User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:34.0) Gecko/20100101 Thunderbird/34.0 MIME-Version: 1.0 To: Robert Simmons Subject: Re: Unicode Problem References: In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Cc: freebsd-python@freebsd.org 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 09:32:45 -0000 On 29/01/2015 6:13 PM, Robert Simmons wrote: > On further inspection I've found the following: > > FreeBSD >>>> import sys >>>> print(sys.getdefaultencoding()) > utf-8 >>>> print(sys.stdout.encoding) > US-ASCII > > MacOS X: >>>> import sys >>>> print(sys.getdefaultencoding()) > utf-8 >>>> print(sys.stdout.encoding) > UTF-8 > > How do I modify stdout encoding to set it to UTF-8 in FreeBSD? Another data point from my 9-STABLE: Python 3.4.2 (default, Nov 3 2014, 13:38:18) [GCC 4.2.1 Compatible FreeBSD Clang 3.4.1 (tags/RELEASE_34/dot1-final 208032)] on freebsd9 Type "help", "copyright", "credits" or "license" for more information. >>> b'\xc3\xa2'.decode('utf-8') 'รข' >>> import sys >>> print(sys.getdefaultencoding()) utf-8 >>> print(sys.stdout.encoding) UTF-8 >>> Python 2.7.9 (default, Jan 24 2015, 20:39:40) [GCC 4.2.1 Compatible FreeBSD Clang 3.4.1 (tags/RELEASE_34/dot1-final 208032)] on freebsd9 Type "help", "copyright", "credits" or "license" for more information. >>> b'\xc3\xa2'.decode('utf-8') u'\xe2' >>> import sys >>> print(sys.getdefaultencoding()) ascii >>> print(sys.stdout.encoding) UTF-8 >>>