Hi,
I've got a gripe with IronPython's file implementation. The following code
produces two different results in CPython and IronPython:
print ''.join('%02x' % ord(c) for c in file('some_binary_file').read(32))
CPython:
01044c1045a1470ec2011201000020000000ec0f0000030000006f1e0000fcc5
IronPython:
01044c1045470e0112010000200000000f0000030000006f1e000052441d3641
One of the causes of this appears to be the fact that PythonFile is
implemented using a StreamReader, for binary mode, which attempts to decode
data that is read from the underlying stream, which is not how Python's file
object works.
Another problem (that contributes to the confusion) is that IronPython
represents Python's "str" type as .NET's "string" type which is described as
something that "Represents text as a series of Unicode characters", whereas
"str" is actually more like a byte[], while "unicode" is more like .NET's
"string" type.
--
Jonathan
When you meet a master swordsman,
show him your sword.
When you meet a man who is not a poet,
do not show him your poem.
-- Rinzai, ninth century Zen master
_______________________________________________
users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com