Message161151
| Author |
giampaolo.rodola |
| Recipients |
David.Sankel, Matt.Mackall, akira, amaury.forgeotdarc, brian.curtin, christian.heimes, christoph, davidsarah, ezio.melotti, giampaolo.rodola, hippietrail, lemburg, mark, mhammond, pitrou, santoso.wijaya, smerlin, ssbarnea, terry.reedy, tim.golden, tzot, v+python, vstinner |
| Date |
2012年05月19日.18:55:40 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1337453741.43.0.0339857115988.issue1602@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
Not sure whether a solution has already been proposed because the issue is very long, but I just bumped into this on Windows and come up with this:
from __future__ import print_function
import sys
def safe_print(s):
try:
print(s)
except UnicodeEncodeError:
if sys.version_info >= (3,):
print(s.encode('utf8').decode(sys.stdout.encoding))
else:
print(s.encode('utf8'))
safe_print(u"\N{EM DASH}")
Couldn't python do the same thing internally? |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2012年05月19日 18:55:41 | giampaolo.rodola | set | recipients:
+ giampaolo.rodola, lemburg, mhammond, terry.reedy, tzot, amaury.forgeotdarc, pitrou, vstinner, christian.heimes, tim.golden, mark, christoph, ezio.melotti, v+python, hippietrail, ssbarnea, brian.curtin, davidsarah, santoso.wijaya, akira, David.Sankel, smerlin, Matt.Mackall |
| 2012年05月19日 18:55:41 | giampaolo.rodola | set | messageid: <1337453741.43.0.0339857115988.issue1602@psf.upfronthosting.co.za> |
| 2012年05月19日 18:55:40 | giampaolo.rodola | link | issue1602 messages |
| 2012年05月19日 18:55:40 | giampaolo.rodola | create |
|