[Ironpython-users] ipy64 Unicode file vs. pipe

Malcolm Slaney malcolmslaney at gmail.com
Wed Apr 3 21:25:06 CEST 2013


Maybe this is well known, but I couldn't find it on the web.

Iron Python is pretty wonderful, but it gave me very confusing output.  It
likes Unicode.  But I don't want Unicode output.  All my output (as part of
a processing chain) are numbers and spaces.   ASCII is good for this (and
that's what the other tools want.)

If I run a simple command and send the output to a file I get Unicode. But
the exact same command when sent to a pipe gives me ASCII.  ARGGHH.   Took
me a long time to figure out this simple test case.

This behavior should be (better) documented.  Hopefully this email will save
somebody else a lot of head scratching.

- Malcolm
P.S.  The example below uses the Gnu on  Windows command od to display the
actual contents of the file in hex.  The first example shows ASCII output,
while the second output looks like Unicode to me.



PS Z:\PitchTracking> ipy64.exe -c "print 'hello'" | od -x
0000000 6568 6c6c 0d6f 000a
0000007

PS Z:\PitchTracking> ipy64.exe -c "print 'hello'" > junk
PS Z:\PitchTracking> od -x junk
0000000 feff 0068 0065 006c 006c 006f 000d 000a
0000020



More information about the Ironpython-users mailing list