String encode() method error handling options?

Grant Edwards grante at visi.com
Tue Jun 19 11:19:43 EDT 2001


The documentation for the encode() method mentions that the
default action for an encoding error is to raise ValueError.
The other options are 'ignore' and 'replace'.  Can anybody
point me to documentation on or examples of the ingore and
replace options?

When doing encode('latin-1') on unicode strings received via
COM/MAPI, I occasionally get a value error.  When I look at the
message with Outlook there's nothing obviously strange about
the text.  I forgot to save an example that causes the error,
so I don't currently have any way to experiment.

-- 
Grant Edwards                   grante             Yow!  Is the EIGHTIES
                                  at               when they had ART DECO
                               visi.com            and GERALD McBOING-BOING
                                                   lunch boxes??



More information about the Python-list mailing list