Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Jan 2015 02:13:43 -0500
From:      Robert Simmons <rsimmons0@gmail.com>
To:        freebsd-python@freebsd.org
Subject:   Re: Unicode Problem
Message-ID:  <CA%2BQLa9Amvu%2B1hg4Oo5J_CjoJNF2Ahs6LAkPrOAEncNU_iWXEtQ@mail.gmail.com>
In-Reply-To: <CA%2BQLa9DnD4mYSBc3B_SUZ6shH64v8Lej_CMMVaK=s%2BPrQp5Gvw@mail.gmail.com>
References:  <CA%2BQLa9DnD4mYSBc3B_SUZ6shH64v8Lej_CMMVaK=s%2BPrQp5Gvw@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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?

On Thu, Jan 29, 2015 at 1:38 AM, Robert Simmons <rsimmons0@gmail.com> wrote=
:
> I'm having a unicode problem on FreeBSD lang/python34 that does not
> appear on MacOS X. I've condensed the problem to one single line to
> enter in the interpreter:
>
> FreeBSD:
> Python 3.4.2 (default, Jan 28 2015, 22:23:57)
> [GCC 4.2.1 Compatible FreeBSD Clang 3.4.1 (tags/RELEASE_34/dot1-final
> 208032)] on freebsd10
> Type "help", "copyright", "credits" or "license" for more information.
>>>> b'\xc3\xa2'.decode('utf-8')
> '\xe2'
>
> MacOS X:
> Python 3.4.2 (default, Oct 19 2014, 17:55:38)
> [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.54)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
>>>> b'\xc3\xa2'.decode('utf-8')
> '=C3=A2'
>
> Why is Python on FreeBSD incorrectly decoding this?



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CA%2BQLa9Amvu%2B1hg4Oo5J_CjoJNF2Ahs6LAkPrOAEncNU_iWXEtQ>