[docs] printing unicode strings

Chuck Simmons csimmons at google.com
Fri Aug 9 21:36:17 CEST 2013

Context:  I'm getting

UnicodeEncodeError: 'ascii' codec can't encode character u'\u2019' in
position 7: ordinal not in range(128)

from the code

print '%s%s%s' % (prefix, value, suffix),

[Here, 'value' contains unicode characters, while prefix and suffix contain
7-bit characters.]

So I went to
to determine what I should do to fix my bug.  I saw the section "Reading
and Writing Unicode
which seemed relevant. That section doesn't seem to discuss printing to

No doubt I got confused and didn't read carefully enough, but it might be
the case that if the Reading and Writing section had an example of printing
a unicode string to stdout that it would have helped me find a solution

g'luck, Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/docs/attachments/20130809/11e2eb75/attachment-0001.html>

More information about the docs mailing list