[Pythonmac-SIG] str.decode() behaves differently in 2.5 and 2.6
Just van Rossum
just at letterror.com
Sun Oct 12 15:27:21 CEST 2008
It seems as if 2.5 uses native byte order by default, and 2.6 big
endian (if there's no Byte Orde Mark). Maybe a bug, maybe a bug fix,
I don't know :). In the meantime, just use 'utf-16be' or 'uft-16le'
explicitly or make sure there's a BOM.
Just
On Oct 12, 2008, at 12:42 PM, has wrote:
> Hi folks,
>
> 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'
>
> $ 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'
>
>
> OS X 10.5.5/i386 using default 2.5.1 Python installation vs. the
> Python 2.6 framework distribution from python.org.
>
> has
> --
> Control AppleScriptable applications from Python, Ruby and ObjC:
> http://appscript.sourceforge.net
>
> _______________________________________________
> Pythonmac-SIG maillist - Pythonmac-SIG at python.org
> http://mail.python.org/mailman/listinfo/pythonmac-sig
>
More information about the Pythonmac-SIG
mailing list