codecs.StreamRecoder not doing what I expected.

Laura Creighton lac at openend.se
Sun Dec 13 07:17:24 EST 2015


In a message of Sun, 13 Dec 2015 01:35:45 -0500, "D'Arcy J.M. Cain" writes:
>When I try to print it to the web page it fails because the \xe9
>character is not valid ASCII.  However, my default encoding is utf-8.
>Other web pages on the same server display fine.
>
>I have the following in the Apache config by the way.
>
>SetEnv PYTHONIOENCODING utf8
>
>So, my file is utf-8, I am reading it as utf-8, my Apache server output
>is set to utf-8.  How is ASCII sneaking in?

What is your sys.stdout.encoding ?

just import sys and print the thing.

I think you will find that it is not what you expect.

Laura




More information about the Python-list mailing list