font display problem in IDLE

Oktay Safak oktay_safak at yahoo.com
Fri Oct 5 04:11:17 EDT 2001


Thank you very much Kirill, your suggestion solved my problem perfectly. At
first IDLE gave some "ASCII error" messages, but then I remembered that I
had deleted the sitecustomize.py file while trying to solve the problem. I
restored it, and everything is working  perfectly now. But I wonder how you
managed to find that solution, which I think is far from being a trivial
one. Perhaps you should consider writing a How-To about this subject. This
must be biting lots of people. And, do you think that this is a bug of IDLE
or is there a reason why this is the default behaviour?

Gratefully yours,

Oktay Safak

**********************************************************
For the sake of completeness, and for those who have had the same problem:
__________________________________________________________

Create a new text file in the folder where your Python executable resides,
name it sitecustomize.py and put these lines in it:

import sys
sys.setdefaultencoding("ISO 8859-9")

close and save the file. The ISO encoding no given above is for Turkish. Of
the encodings given below, use the appropriate one for your language: (taken
from www.unicode.org)

8859-1 (Latin-1)
8859-2, -3, -4, -9 (European Latin)
8859-5 (Cyrillic)
8859-6 (Arabic)
8859-7 (Greek)
8859-8 (Hebrew)

and then follow Kirill's instructions given below. After everything is done,
run IDLE and enjoy it.

----- Original Message -----
From: "Kirill Simonov" <kirill at xyz.donetsk.ua>
To: <python-list at python.org>
Sent: Wednesday, October 03, 2001 11:04 PM
Subject: Re: font display problem in IDLE


> On Wed, Oct 03, 2001 at 10:45:48AM -0700, Oktay Safak wrote:
> >
> > I use sitecustomize.py to use turkish encoding, the
> > console gets it right but on IDLE, the characters
> > special to my language are not displayed properly,
> > some other funny characters are shown instead. When I
> > write some text to a file and inspect the file with
> > notepad I see that the characters are OK. So IDLE does
> > what I want but does not show it properly. I tried to
> > configure IDLE by changing the font it uses for
> > display from its config file but somehow a sans-serif
> > font shows up instead of courier new, and it still
> > shows the wrong encoding. Any ideas? German and French
> > fellows might have had a similar problem I guess.
> >
>
> I expect that you use Python 2.1 on Windows.
>
> The recipe is:
>
> Step 1:
> Open file "Python21/Lib/lib-tk/FixTk.py", remove all lines and write the
> following code:
>
> import sys, os
> if not os.environ.has_key('TCL_LIBRARY'):
>     tcl_library = os.path.join(sys.prefix, "tcl", "tclX.Y")
>     os.environ['TCL_LIBRARY'] = tcl_library
>
> Step 2:
> Open file "Python21/Tools/idle/Percolator.py", go to the line 23.
> You need to insert two lines of code into the function "insert":
>
>      def insert(self, index, chars, tags=None):
>          # Could go away if inheriting from Delegator
>          if index != 'insert':          # You need to add
>             chars = unicode(chars)      # these lines.
>          self.top.insert(index, chars, tags)
>
> Step 3:
> Open file "Python21/Tools/idle/PyShell.py", go to the line 470.
> You need to add two lines:
>
>          line = self.text.get("iomark", "end-1c")
>          if type(line) == type(u""):    # You need to add
>              line = line.encode()       # these lines.
>          self.resetoutput()
>
> And please tell me, does this recipe solves your problem?
>
>
> \Xi
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>






More information about the Python-list mailing list