[Python-Dev] unicode() and its error argument

Oleg Broytmann Oleg Broytmann <phd@phd.pp.ru>
Tue, 18 Jun 2002 18:51:27 +0400


Hello!

On Sat, Jun 15, 2002 at 07:04:41PM +0400, Oleg Broytmann wrote:
> On Sat, Jun 15, 2002 at 11:05:12AM -0400, Guido van Rossum wrote:
> > >    I got the error very often (but I use encoding conversion much more
> > > often than you). First time I saw it I was very surprized that neither
> > > "ignore" nor "replace" can eliminate the error.
> > 
> > Got an example?
> 
>    Not right now... I'll send it when I get one.

   Sorry for the false alarm. It was my fault. I used to write

s = unicode(s, "cp1251").encode("koi8-r", "replace")

   where I need

s = unicode(s, "cp1251", "replace").encode("koi8-r", "replace")                         ^^^^^^^^^

Oleg.
-- 
     Oleg Broytmann            http://phd.pp.ru/            phd@phd.pp.ru
           Programmers don't die, they just GOSUB without RETURN.