Unicode Problem

Kubilay Kocak koobs at FreeBSD.org
Thu Jan 29 09:32:45 UTC 2015


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
>>>


More information about the freebsd-python mailing list