Hi,

Thanks for the detailed response.

On Jul 1, 2:14 pm, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote:
> > 1) If you print a unicode string:
> >
> > a) str() calls encode(), and encode() tries to convert the unicode
> > string to a regular string.  encode() uses the default encoding, which
> > is ascii.  If encode() can't convert a character, then encode() raises
> > an exception.
>
> Yes and no. This is what str() does, but str() isn't called. Instead,
> print inspects sys.stdout.encoding, and uses that encoding to encode
> the string. That, in turn, may raise an exception (in particular if
> sys.stdout.encoding is "ascii" or not set).
>

Is that the same as print calling encode(u_str, sys.stdout.encoding)


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to