[Python-Dev] Relaxing Unicode error handling

M.-A. Lemburg mal at egenix.com
Tue Jan 6 16:30:22 EST 2004

Martin v. Loewis wrote:
> M.-A. Lemburg wrote:
>> But if you change the default behaviour of the builtin codecs
>> only, how would this help a user of a broken application ?
> It would be even sufficient to change the behaviour of the us-ascii
> codec, as this is the default codec.

So you are only talking about the case where the application
uses the standard default encoding (ASCII) and does not
make use of any other codecs ?

> The user of the broken implementation would get question marks
> in places that would previously cause an exception. That may
> be acceptable, if it is only debugging output or log files;
> it may be tolerable if this is only for text seen by users.
>> The Unicode implementation would continue to use "strict"
>> for things like low-level parser marker conversions and external
>> codecs would also not work as expected (e.g. the Asian codecs).
> Sure, but they would also not be the default codecs.

Why not ? What about Asian users who set the default encoding
to one of the encodings supported by e.g. the JapaneseCodecs
package ?

> Not sure what "low-level parser marker conversions" are:
> what is a "parser marker"?

Oh, sorry, that's the term I use for PyArg_ParseTuple() format

>> In the end, I don't think we'd gain anything much except another
>> global to carry around.
> It will make developers happier, as they need less urgently fix
> applications that blow up at the customer.

Given the scenario you mention above, wouldn't that also be
possible by providing a customized codec for "ascii" under
a new name "all-things-ascii" and then setting the default
encoding to "all-things-ascii" ?

In general I don't like these global settings.

Just think of the issues this could cause in multi-user systems
such as Zope that are not prepared for these changes:
a script could easily change the settings to have
the server execute code under different user ids if threads
executing their requests generate codec errors (the errors
parameter can be set to a callback now that we have the new
logic in place...).

Marc-Andre Lemburg

Professional Python Services directly from the Source  (#1, Jan 06 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 mailing list