And because python2.3 lacks sys.setappdefaultencoding, so have to reload(sys), and use sys.setdefaultencoding.<br><br>The patch for svn-2875:<br><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
Index: IPython/iplib.py</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">===================================================================
</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">--- IPython/iplib.py £¨ÐÞ¶©°æ 2876£©</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+++ IPython/iplib.py £¨¹¤×÷¿½±´£©</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">@@ -79,6 +79,14 @@</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
import IPython.shadowns</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> # Globals</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+# make converting between str and unicode easy</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
+try:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ sys.setappdefaultencoding(sys.stdin.encoding or 'ascii')</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+except:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ # python2.3 does not have sys.setappdefaultencoding</span>
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ reload(sys)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+
sys.setdefaultencoding(sys.stdin.encoding or 'ascii')</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> # store the builtin raw_input globally, and use this always, in case user code</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
# overwrites it (like wx.py.PyShell does)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> raw_input_original = raw_input</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">@@ -1911,7 +1919,7 @@</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
# this allows execution of indented pasted code. It is tempting</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> # to add '\n' at the end of source to run commands like ' a=1'
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> # directly, but this fails for more complicated scenarios</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- source=source.encode(self.stdin_encoding)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ source = str(source)
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> if source[:1] in [' ', '\t']:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
source = 'if 1:\n%s' % source</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">
<br>