On Wednesday 05 May 2010, Pet wrote:

> I'm using Twisted 10.0 and as usually sometime print debug infos with
> myunicodestr.encode('UTF-8') which are saved to logfile, but since
> using twisted 10 I'm getting
> 
> UnicodeEncodeError: 'ascii' codec can't encode characters...

UTF-8 uses the full 8 bits of a byte, while ASCII only uses 7, so writing 
Unicode encoded as UTF-8 to an ASCII stream is not valid.

I think recent Python versions are more strict about what is written to 
stdout/stderr than older versions, it might not be related to Twisted 
itself. You can specify a different encoding for stdin/out/err by setting 
the PYTHONIOENCODING environment variable.

Bye,
                Maarten

_______________________________________________
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

Reply via email to