i replaced (in class Parser, method fromFile)<br>
StreamReader sr = new StreamReader(File.OpenRead(filename), System.Text.Encoding.ASCII);<br>
with<br>
StreamReader sr = new StreamReader(File.OpenRead(filename), System.Text.Encoding.Default);<br>
<br>
and PythonEngine.ExecuteFile() now display correctly<br>
<br>
<br>
<br><br><div><span class="gmail_quote">在05-8-11,<b class="gmail_sendername">徐宁</b> <<a href="mailto:alcarx@gmail.com">alcarx@gmail.com</a>> 写道:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Just use the example shiped with IronPython9.0.<br>
<br>
Add a class named Embed5<br>
<br>
////////////////////////////////////////////////////////////////////////////////////////////<br>
public class Embed5<br>
{<br>
//the file to be executed<br>
const string fileName = @"D:/TestChinese.py";<br>
<br>
public static void Run()<br>
{<br>
PythonEngine engine = new PythonEngine();<br>
engine.ExecuteFile(fileName);<br>
Application.Run();<br>
}<br>
}<br>
//////////////////////////////////////////////////////////////////////////////////////////////<br>
And content of TestChinese.py is <br>
<br>
##########################################<br>
<br>
from System import *<br>
from System.Windows.Forms import *<br>
MessageBox.Show("你好,IronPython")<br>
<br>
#########################################<br>
<br>
in Program.cs add "Embed5.Run();"<br>
<br>
while i run this example, the string "你好" can't be correctly displayed.<br>
<br>
but if i use IronPythonConsole to execute MessageBox.Show("你好,IronPython"),<br>
it works fine<br>
<br>
<br>
<br><div><span class="gmail_quote">2005/8/11, Martin Maly <<a href="mailto:martmaly@exchange.microsoft.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">martmaly@exchange.microsoft.com</a>>:
</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><span class="e" id="q_105a3a419e394bf5_1">
<div align="left" dir="ltr"><span><font face="Verdana" size="2">Would it be possible for you to send us a short code snippet that you had
problem with? I would like to find out whether the problem is in parsing,
encoding usage, etc.</font></span></div>
<div align="left" dir="ltr"><span><font face="Verdana" size="2"></font></span> </div>
<div align="left" dir="ltr"><span><font face="Verdana" size="2">Martin</font></span></div><br>
<blockquote style="border-left: 2px solid rgb(0, 0, 0); padding-left: 5px; margin-left: 5px; margin-right: 0px;" dir="ltr">
<div align="left" dir="ltr" lang="en-us">
<hr>
<font face="Tahoma" size="2"><b>From:</b>
<a href="mailto:users-ironpython.com-bounces@lists.ironpython.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">users-ironpython.com-bounces@lists.ironpython.com</a>
[mailto:<a href="mailto:users-ironpython.com-bounces@lists.ironpython.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">users-ironpython.com-bounces@lists.ironpython.com</a>] <b>On Behalf Of
</b>??<br><b>Sent:</b> Wednesday, August 10, 2005 9:22 AM<br><b>To:</b>
<a href="mailto:users-ironpython.com@lists.ironpython.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">users-ironpython.com@lists.ironpython.com</a><br><b>Subject:</b> [IronPython]
language Support-Chinese<br></font><br></div><div><span>
<div></div>
<div>it seems that ironpython does not support chinese.</div>
<div> </div>
<div>i used ironpython in one project</div>
<div> </div>
<div>and tried to display some information in chinese ,</div>
<div> </div>
<div>but these words can't be correctly displayed.</div>
<div> </div>
<div>i wonder if u could kindly give me some advice on sovling this
problem.</div>
<div> </div></span></div></blockquote></span></div>
<br>_______________________________________________<br><a href="http://users-ironpython.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">users-ironpython.com</a> mailing list<span class="q"><br>
<a href="mailto:users-ironpython.com@lists.ironpython.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
users-ironpython.com@lists.ironpython.com</a><br></span><a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
</a><br><br><br></blockquote></div><br><br><br>-- <br>The shift of focus (to patterns) will <br>have a profound and enduring effect <br>on the way we write programs.<br> --Ward Cunningham and Ralph Johnson
</blockquote></div><br><br><br>-- <br>The shift of focus (to patterns) will <br>have a profound and enduring effect <br>on the way we write programs.<br> --Ward Cunningham and Ralph Johnson