[Idle-dev] CVS: idle OutputWindow.py,1.8,1.9

Kurt B. Kaiser kbk@users.sourceforge.net
Wed, 09 Jul 2003 13:47:47 -0700


Update of /cvsroot/idlefork/idle
In directory sc8-pr-cvs1:/tmp/cvs-serv5822

Modified Files:
	OutputWindow.py 
Log Message:
IDLEfork Patch 615312 
"Forwardport Locale Encoding I/O Patch"
There was no need to forwardport this.


Index: OutputWindow.py
===================================================================
RCS file: /cvsroot/idlefork/idle/OutputWindow.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** OutputWindow.py	31 Dec 2002 15:59:14 -0000	1.8
--- OutputWindow.py	9 Jul 2003 20:47:45 -0000	1.9
***************
*** 3,6 ****
--- 3,7 ----
  import re
  import tkMessageBox
+ import IOBinding
  
  class OutputWindow(EditorWindow):
***************
*** 35,38 ****
--- 36,47 ----
  
      def write(self, s, tags=(), mark="insert"):
+         # Tk assumes that byte strings are Latin-1;
+         # we assume that they are in the locale's encoding
+         if isinstance(s, str):
+             try:
+                 s = unicode(s, IOBinding.encoding)
+             except UnicodeError:
+                 # some other encoding; let Tcl deal with it
+                 pass
          self.text.insert(mark, s, tags)
          self.text.see(mark)