Article View: pl.comp.lang.python
Article #362Kodowanie znaków w Tkinter
From: Jarek Zgoda
Date: Fri, 13 Dec 2002 20:18
Date: Fri, 13 Dec 2002 20:18
27 lines
1667 bytes
1667 bytes
Próbuję z widgetu Entry pobrać jego zawartość i "przypadkiem" znalazły
się w niej polskie znaki, co spowodowało poniższy wyjątek. Ręce mi
opadły.
Exception in Tkinter callback
Traceback (most recent call last):
File "/usr/lib/python2.2/lib-tk/Tkinter.py", line 1292, in __call__
return apply(self.func, args)
File "tkentry.py", line 21, in say_hi
print self.entry.get()
UnicodeError: ASCII encoding error: ordinal not in range(128)
W module sitecustomize.py mam wpisane:
import locale
loc = locale.getdefaultlocale()
if loc[1]:
encoding = loc[1] #(zwraca ISO8859-2)
sys.setdefaultencoding(encoding)
I kupa...
Co można z tym zrobić?
--
Jarek Zgoda
http://www.zgoda.biz/
--
Serwis Usenet w portalu Gazeta.pl -> http://www.gazeta.pl/usenet/
Technical Details
Message-ID:
<20021213211848.34fd5392.jzgoda@usun.gazeta.pl>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!pingwin.icm.edu.pl!mat.uni.torun.pl!news.man.torun.pl!news.icm.edu.pl!mimuw.edu.pl!news.mimuw.edu.pl!news.internetia.pl!newsfeed.gazeta.pl!news.gazeta.pl!not-for-mailShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!pingwin.icm.edu.pl!mat.uni.torun.pl!news.man.torun.pl!news.icm.edu.pl!mimuw.edu.pl!news.mimuw.edu.pl!news.internetia.pl!newsfeed.gazeta.pl!news.gazeta.pl!not-for-mail From: Jarek Zgoda <jzgoda@usun.gazeta.pl> Newsgroups: pl.comp.lang.python Subject: Kodowanie znaków w Tkinter Date: Fri, 13 Dec 2002 21:18:48 +0100 Organization: Groove Family Cyco Lines: 27 Message-ID: <20021213211848.34fd5392.jzgoda@usun.gazeta.pl> NNTP-Posting-Host: qg120.neoplus.adsl.tpnet.pl Mime-Version: 1.0 X-Trace: news.gazeta.pl 1039811586 17136 80.50.244.120 (13 Dec 2002 20:33:06 GMT) X-Complaints-To: usenet@agora.pl NNTP-Posting-Date: Fri, 13 Dec 2002 20:33:06 +0000 (UTC) X-Newsreader: Sylpheed version 0.8.6claws (GTK+ 1.2.10; ) X-User: jzgoda Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit