[Python-Dev] Relaxing Unicode error handling
mal at egenix.com
Sun Jan 4 18:23:04 EST 2004
Martin v. Loewis wrote:
> People keep complaining that they get Unicode errors
> when funny characters start showing up in their inputs.
> In some cases, these people would apparantly be happy
> if Python would just "keep going", IOW, they want to
> get moji-bake (garbled characters), instead of
> exceptions that abort their applications.
> I'd like to add a static property unicode.errorhandling,
> which defaults to "strict". Applications could set this
> to "replace" or "ignore", silencing the errors, and
> risking loss of data.
> What do you think?
Codecs define what the default error handling should be (setting
errors to NULL), not the Unicode implementation.
/* === Builtin Codecs =====================================================
Many of these APIs take two arguments encoding and errors. These
parameters encoding and errors have the same semantics as the ones
of the builtin unicode() API.
Setting encoding to NULL causes the default encoding to be used.
Error handling is set by errors which may also be set to NULL
meaning to use the default handling defined for the codec. Default
error handling for all builtin codecs is "strict" (ValueErrors are
In some cases, "strict" is hard coded as errors argument to override
the default value and that is done to prevent invalid data from
propagating undetected throughout the application.
Professional Python Services directly from the Source (#1, Jan 04 2004)
>>> Python/Zope Consulting and Support ... http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::
More information about the Python-Dev