Article View: pl.comp.lang.python
Article #27687Re: python 3.1 print i krzaki - ratunku!!!
From: klops
Date: Fri, 24 Sep 2010 16:50
Date: Fri, 24 Sep 2010 16:50
23 lines
1772 bytes
1772 bytes
> jak widac, konsola uzywa kodowania cp852, wiec mozesz wypisywac tylko
> znaki mieszczace sie w tym kodowaniu...
no dobra zrobiłem tak:
sys.stdout = codecs.getwriter('cp852')(sys.stdout.buffer)
Co daje w wyniku:
Traceback (most recent call last):
File "lc.py", line 30, in <module>
print("Copyright \xa9 Klops")
File "c:\program files\python 3.1\lib\encodings\cp852.py", line 19,
in encode
return codecs.charmap_encode(input,self.errors,encoding_map)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\xa9' in
position 10
: character maps to <undefined>
Idealnie było by, gdybym miał autodetekcję kodowania konsoli i
ustawianie tego kodowania. Jak to zrobić żeby skrypt bezdotykowo (i
prawidłowo) działał na różnych systemach operacyjnych???
Technical Details
Message-ID:
<4c9d0fe3$0$20990$65785112@news.neostrada.pl>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!newsfeed2.atman.pl!newsfeed.atman.pl!newsfeed.neostrada.pl!unt-exc-02.news.neostrada.pl!unt-spo-b-01.news.neostrada.pl!news.neostrada.pl.POSTED!not-for-mailReferences:
<4c9bc5b4$0$27047$65785112@news.neostrada.pl> <op.vjiod0lpus2y1v@klaptop7>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!newsfeed2.atman.pl!newsfeed.atman.pl!newsfeed.neostrada.pl!unt-exc-02.news.neostrada.pl!unt-spo-b-01.news.neostrada.pl!news.neostrada.pl.POSTED!not-for-mail Date: Fri, 24 Sep 2010 18:50:13 +0200 From: klops <klops@klopsserver.pl> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; pl; rv:1.9.2.9) Gecko/20100915 Thunderbird/3.1.4 MIME-Version: 1.0 Newsgroups: pl.comp.lang.python Subject: Re: python 3.1 print i krzaki - ratunku!!! References: <4c9bc5b4$0$27047$65785112@news.neostrada.pl> <op.vjiod0lpus2y1v@klaptop7> In-Reply-To: <op.vjiod0lpus2y1v@klaptop7> Lines: 23 Message-ID: <4c9d0fe3$0$20990$65785112@news.neostrada.pl> Organization: Telekomunikacja Polska NNTP-Posting-Host: 83.21.180.145 X-Trace: 1285361635 unt-rea-a-01.news.neostrada.pl 20990 83.21.180.145:51872 X-Complaints-To: abuse@news.neostrada.pl Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit