Tkinter - non-ASCII characters in text widgets problem

norseman norseman at hughes.net
Thu Jun 25 17:57:08 EDT 2009


Sebastian Pająk wrote:
> 2009/6/25 "Martin v. Löwis" <martin at v.loewis.de>:
>>> I've tried various UTF file encoding (also with BOM mark), use of
>>> u"text"
>> Always use u"text". This should work. Everything else might not work.
> 
> But I tried this here without success
> 
>>> After applying this, the effect remains the same - one big garbage.
>> Can you please be more specific? What is "one big garbage"?
>>
> 
> There is a square (or some other weird sign) in place where polish
> accented character should be (like "ęłąśł" etc)
> This problem is only on mac os x and it doesn't apply to button widget
> (where characters are correct)
> 
>>> I'm out of ideas: my script is UTF-8 in 101%; Mac and Windows both
>>> support UTF-8, Python also supports it - so where is the problem?
>> Most likely, Tk does not work correctly on your system. See whether
>> you can get correct results with wish.
>>
> 
> There is no wish. I'm talking about build-in Tkinter (isn't Tk
> build-in Python?).
> 
> btw. I'm workin on Windows, my friend on Mac - he points me the
> problem he has with my script. He is not a computer geek nor a
> programmer - he even doesn't know what wish/Tk or Python is
> 
> 
> Does different endianness can have something to do here?
================
Can, but should not.
I read that the problem is when using the Polish language only. 
Otherwise things work normally. Is that correct?
If so then byte swap may be a problem.  Using the u'string' should solve 
that. I am assuming you have the Polish alphabet working correctly on 
your machine. I think I read that was so in an earlier posting.

Are there any problems with his alphabet scrambling on your machine?
If so that needs investigating.  Here I assume you are reading Polish 
from him on your machine and not a network translator version.


No - Tkinter is not built in. tkinter is a module shipped with Python 
for people to use. (Tk interface)  use:  import tkinter

 From Google:
Tkinter Life Preserver
Tkinter is a Python interface to the Tk GUI toolkit.
This document is not designed to be an exhaustive tutorial on either Tk 
or Tkinter. ...www.python.org/doc/life-preserver/

more properly   Tcl/Tk
see also        www.tcl.tk



Steve



More information about the Python-list mailing list