How to display unicode with the CGI module?

paul paul at subsignal.org
Mon Nov 26 05:50:50 EST 2007


greg schrieb:
> paul wrote:
>> However, this will change in py3k..., 
>> what's the new rule of thumb?
[snipp]

> So you won't be able to get away with ignoring encoding
> issues in py3k. On the plus side, it should all be handled
> in a much more consistent and less error-prone way. If
> you mistakenly try to use encoded data as though it were
> decoded data or vice versa, you'll get a type error.
Thanks for your detailed answer. In fact, having encode() only for <str> 
and decode() for <byte> will simplify things a lot. I guess implicit 
encode() of <str> when using print() will stay but having utf-8 as the 
new default encoding will reduce the number of UnicodeError. You'll get 
weird characters instead ;)

cheers
  Paul




More information about the Python-list mailing list