The culprit here is actually Powershell, which likes to convert text output to UTF-16. I bet you won't see this if you run from cmd.exe.
On Wed, Apr 3, 2013 at 11:32 PM, Markus Schaber <m.scha...@codesys.com>wrote: > Hi, Slide,**** > > Hi, Malcolm,**** > > ** ** > > Both Python and .NET itself have some heuristics to determine the output > encoding on stdout.**** > > ** ** > > And it's well possible that this heuristics get confused depending on the > locale or other settings.**** > > ** ** > > However, this seems to be specific to the machine – on my machine (using > the Cygwin od.exe), the problem does not appear:**** > > ** ** > > D:\ipytest>"c:\Program Files (x86)\IronPython 2.7\ipy64.exe" -c "print > 'hello'" | c:\cygwin\bin\od.exe -x**** > > 0000000 6568 6c6c 0d6f 000a**** > > 0000007**** > > ** ** > > D:\ipytest>"c:\Program Files (x86)\IronPython 2.7\ipy64.exe" -c "print > 'hello'" > foo.txt**** > > ** ** > > D:\ipytest>c:\cygwin\bin\od.exe -x foo.txt**** > > 0000000 6568 6c6c 0d6f 000a**** > > 0000007**** > > ** ** > > Best regards > > Markus Schaber > > *CODESYS®* a trademark of 3S-Smart Software Solutions GmbH > * > **Inspiring Automation Solutions ***** > ------------------------------ > > 3S-Smart Software Solutions GmbH > Dipl.-Inf. Markus Schaber | Product Development Core Technology > Memminger Str. 151 | 87439 Kempten | Germany > Tel. +49-831-54031-979 | Fax +49-831-54031-50 > > E-Mail: m.scha...@codesys.com | Web: codesys.com <http://www.codesys.com>| > CODESYS store: > store.codesys.com > CODESYS forum: forum.codesys.com > > *Managing Directors: Dipl.Inf. Dieter Hess, Dipl.Inf. Manfred Werner* | *Trade > register: Kempten HRB 6186* | *Tax ID No.: DE 167014915** ***** > > *Von:* Ironpython-users [mailto:ironpython-users-bounces+m.schaber= > codesys....@python.org] *Im Auftrag von *Slide > *Gesendet:* Donnerstag, 4. April 2013 00:32 > *An:* malc...@ieee.org > *Cc:* ironpython-users@python.org > *Betreff:* Re: [Ironpython-users] ipy64 Unicode file vs. pipe**** > > ** ** > > Pipe vs. file differences would probably be the realm of the shell you are > running under, not ipy. To ipy, its just stdout.**** > > ** ** > > On Wed, Apr 3, 2013 at 12:25 PM, Malcolm Slaney <malcolmsla...@gmail.com> > wrote:**** > > 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 > > _______________________________________________ > Ironpython-users mailing list > Ironpython-users@python.org > http://mail.python.org/mailman/listinfo/ironpython-users**** > > > > **** > > ** ** > > -- > Website: http://earl-of-code.com **** > > _______________________________________________ > Ironpython-users mailing list > Ironpython-users@python.org > http://mail.python.org/mailman/listinfo/ironpython-users > >
_______________________________________________ Ironpython-users mailing list Ironpython-users@python.org http://mail.python.org/mailman/listinfo/ironpython-users