[Pythonmac-SIG] str.decode() behaves differently in 2.5 and 2.6
Henning Hraban Ramm
hraban at fiee.net
Sun Oct 12 14:30:15 CEST 2008
Am 2008-10-12 um 12:42 schrieb has:
> Figure I should check here before filing a bug. Anyone understand
> the following discrepancy between 2.5 and 2.6:
>
> $ python2.5
> Python 2.5.1 (r251:54863, Jan 17 2008, 19:35:17)
> [GCC 4.0.1 (Apple Inc. build 5465)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> >>> '\x41\x00'.decode('utf16')
> u'A'
same with 2.5.2:
Python 2.5.2 (r252:60911, Feb 22 2008, 07:57:53)
[GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> '\x41\x00'.decode('utf16')
u'A'
> $ python2.6
> Python 2.6 (trunk:66714:66715M, Oct 1 2008, 18:36:04)
> [GCC 4.0.1 (Apple Computer, Inc. build 5370)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> >>> '\x41\x00'.decode('utf16')
> u'\u4100'
\u4100 is some Chinese character - clearly a bug I'd say.
Greetlings from Lake Constance!
Hraban
---
http://www.fiee.net
https://www.cacert.org (I'm an assurer)
More information about the Pythonmac-SIG
mailing list