Message161151
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? |
|
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 | |
|