[issue4060] PyUnicode_DecodeUTF16(..., byteorder=0) gets it wrong on Mac OS X/PowerPC

Trent Mick report at bugs.python.org
Tue Oct 7 00:31:29 CEST 2008


Trent Mick <trentm at gmail.com> added the comment:

This also shows up in the byte ordering that Python uses to encode utf-16:

$ uname -a
Darwin sphinx 8.11.0 Darwin Kernel Version 8.11.0: Wed Oct 10 18:26:00
PDT 2007; root:xnu-792.24.17~1/RELEASE_PPC Power Macintosh powerpc

$ python2.6 -c "import codecs; codecs.open('26.txt', 'w',
'utf-16').write('hi')"
$ od -cx 26.txt
0000000  377 376   h  \0   i  \0
             fffe    6800    6900
0000006

$ /usr/bin/python -c "import codecs; codecs.open('system.txt', 'w',
'utf-16').write('hi')"
$ od -cx system.txt
0000000  376 377  \0   h  \0   i
             feff    0068    0069
0000006


The BOM here ensures, of course, that this is still valid UTF-16
content, but the difference in behaviour here btwn Python versions might
not be intended.

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4060>
_______________________________________


More information about the Python-bugs-list mailing list