<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:SimSun;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:SimSun;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"\@SimSun";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.E-MailFormatvorlage17
        {mso-style-type:personal-reply;
        font-family:"Arial","sans-serif";
        color:windowtext;
        font-weight:normal;
        font-style:normal;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="DE" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif"">Hi, Slide,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif"">Hi, Malcolm,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif""><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif"">Both Python and .NET itself have some heuristics to determine the output encoding on stdout.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif""><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif"">And it's well possible that this heuristics get confused depending on the locale or other settings.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif""><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif"">However, this seems to be specific to the machine – on my machine (using the Cygwin od.exe), the problem does not appear:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif""><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif"">D:\ipytest>"c:\Program Files (x86)\IronPython 2.7\ipy64.exe" -c "print 'hello'" | c:\cygwin\bin\od.exe -x<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif"">0000000 6568 6c6c 0d6f 000a<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif"">0000007<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif""><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif"">D:\ipytest>"c:\Program Files (x86)\IronPython 2.7\ipy64.exe" -c "print 'hello'" > foo.txt<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif""><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif"">D:\ipytest>c:\cygwin\bin\od.exe -x foo.txt<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif"">0000000 6568 6c6c 0d6f 000a<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif"">0000007<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif""><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif";color:black">Best regards<br>
<br>
Markus Schaber</span><span lang="EN-US"><br>
<br>
</span><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#636363">CODESYS<sup>®</sup></span></b><span lang="EN-US">
</span><span lang="EN-US" style="font-size:8.0pt;font-family:"Arial","sans-serif";color:#B1B2B3">a trademark of 3S-Smart Software Solutions GmbH</span><span lang="EN-US">
<br>
</span><b><span lang="EN-US" style="font-size:2.0pt;font-family:"Arial","sans-serif";color:#636363"><br>
</span></b><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#636363">Inspiring Automation Solutions
</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#636363"><o:p></o:p></span></p>
<div class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#636363">
<hr size="1" width="636" style="width:477.0pt" noshade="" style="color:#636363" align="left">
</span></div>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#636363">3S-Smart Software Solutions GmbH
<br>
Dipl.-Inf. Markus Schaber | Product Development Core Technology <br>
Memminger Str. 151 | 87439 Kempten | Germany <br>
Tel. +49-831-54031-979 | Fax +49-831-54031-50 <br>
<br>
E-Mail: </span><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#636363"><a href="mailto:m.schaber@codesys.com"><span lang="EN-US" style="color:#E3000F;text-decoration:none">m.schaber@codesys.com</span></a></span><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#636363">
 | Web: </span><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#636363"><a href="http://www.codesys.com"><span lang="EN-US" style="color:#E3000F;text-decoration:none">codesys.com</span></a></span><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#636363">
 | CODESYS store: </span><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#636363"><a href="http://store.codesys.com"><span lang="EN-US" style="color:#E3000F;text-decoration:none">store.codesys.com</span></a></span><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#636363">
<br>
CODESYS forum: </span><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#636363"><a href="http://forum.codesys.com"><span lang="EN-US" style="color:#E3000F;text-decoration:none">forum.codesys.com</span></a></span><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#636363">
<br>
<br>
</span><i><span lang="EN-US" style="font-size:8.0pt;font-family:"Arial","sans-serif";color:#636363">Managing Directors: Dipl.Inf. Dieter Hess, Dipl.Inf. Manfred Werner</span></i><span lang="EN-US" style="font-size:8.0pt;font-family:"Arial","sans-serif";color:#636363">
 | <i>Trade register: Kempten HRB 6186</i> | <i>Tax ID No.: DE 167014915</i></span><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#636363">
</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif""><o:p></o:p></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt">
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">Von:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Ironpython-users [mailto:ironpython-users-bounces+m.schaber=codesys.com@python.org]
<b>Im Auftrag von </b>Slide<br>
<b>Gesendet:</b> Donnerstag, 4. April 2013 00:32<br>
<b>An:</b> malcolm@ieee.org<br>
<b>Cc:</b> ironpython-users@python.org<br>
<b>Betreff:</b> Re: [Ironpython-users] ipy64 Unicode file vs. pipe<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">Pipe vs. file differences would probably be the realm of the shell you are running under, not ipy. To ipy, its just stdout.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><o:p> </o:p></p>
<div>
<p class="MsoNormal">On Wed, Apr 3, 2013 at 12:25 PM, Malcolm Slaney <<a href="mailto:malcolmslaney@gmail.com" target="_blank">malcolmslaney@gmail.com</a>> wrote:<o:p></o:p></p>
<p class="MsoNormal">Maybe this is well known, but I couldn't find it on the web.<br>
<br>
Iron Python is pretty wonderful, but it gave me very confusing output.  It<br>
likes Unicode.  But I don't want Unicode output.  All my output (as part of<br>
a processing chain) are numbers and spaces.   ASCII is good for this (and<br>
that's what the other tools want.)<br>
<br>
If I run a simple command and send the output to a file I get Unicode. But<br>
the exact same command when sent to a pipe gives me ASCII.  ARGGHH.   Took<br>
me a long time to figure out this simple test case.<br>
<br>
This behavior should be (better) documented.  Hopefully this email will save<br>
somebody else a lot of head scratching.<br>
<br>
- Malcolm<br>
P.S.  The example below uses the Gnu on  Windows command od to display the<br>
actual contents of the file in hex.  The first example shows ASCII output,<br>
while the second output looks like Unicode to me.<br>
<br>
<br>
<br>
PS Z:\PitchTracking> ipy64.exe -c "print 'hello'" | od -x<br>
0000000 6568 6c6c 0d6f 000a<br>
0000007<br>
<br>
PS Z:\PitchTracking> ipy64.exe -c "print 'hello'" > junk<br>
PS Z:\PitchTracking> od -x junk<br>
0000000 feff 0068 0065 006c 006c 006f 000d 000a<br>
0000020<br>
<br>
_______________________________________________<br>
Ironpython-users mailing list<br>
<a href="mailto:Ironpython-users@python.org">Ironpython-users@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/ironpython-users" target="_blank">http://mail.python.org/mailman/listinfo/ironpython-users</a><o:p></o:p></p>
</div>
<p class="MsoNormal"><br>
<br clear="all">
<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p class="MsoNormal">-- <br>
Website: <a href="http://earl-of-code.com" target="_blank">http://earl-of-code.com</a>
<o:p></o:p></p>
</div>
</div>
</div>
</body>
</html>