Am 29.01.2015 um 10:53 schrieb Konstantin Belousov:
> On Thu, Jan 29, 2015 at 08:32:35PM +1100, Kubilay Kocak wrote:
>> 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
>>>>>

On my box, with recent HEAD amd64, it is like for Koobs:

#locale
LANG=de_DE.UTF-8
LC_CTYPE="de_DE.UTF-8"
LC_COLLATE=C
LC_TIME="de_DE.UTF-8"
LC_NUMERIC="de_DE.UTF-8"
LC_MONETARY="de_DE.UTF-8"
LC_MESSAGES="de_DE.UTF-8"
LC_ALL=


#python3
Python 3.4.2 (default, Jan 11 2015, 07:51:41)
[GCC 4.2.1 Compatible FreeBSD Clang 3.5.0 (tags/RELEASE_350/final
216957)] on freebsd11
Type "help", "copyright", "credits" or "license" for more information.
### b'\xc3\xa2'.decode('utf-8')
'รข'


[For python 27, option UCS4 enabled]
#python
Python 2.7.9 (default, Jan 24 2015, 10:35:50)
[GCC 4.2.1 Compatible FreeBSD Clang 3.5.1 (tags/RELEASE_351/final
225668)] on freebsd11
Type "help", "copyright", "credits" or "license" for more information.
### b'\xc3\xa2'.decode('utf-8')
u'\xe2'

So, obviously there is a difference between the python versions,
independently from the locale settings?

_______________________________________________
freebsd-python@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-python
To unsubscribe, send any mail to "freebsd-python-unsubscr...@freebsd.org"

Reply via email to