[Python-Dev] sgmllib Comments

Sam Ruby rubys at intertwingly.net
Mon Jun 12 07:24:45 CEST 2006

Martin v. Löwis wrote:
> Alternatively, a callback function could be provided for character
> references. Unfortunately, the existing callback is unsuitable,
> as it is supposed to do the full processing; this callback should
> return the replacement text. Generally assuming Unicode would be
> wrong, though.
> Would you like to contribute a patch?

If we can agree on the behavior, I would be glad to write up a patch.

It seems to me that the simplest way to proceed would be for the code 
that attempts to resolve character references (both named and numeric) 
in attributes to be isolated in a single method.  Subclasses that desire 
different behavior (including the existing Python 2.4 and prior 
behaviour) could simply override this method.

- Sam Ruby

More information about the Python-Dev mailing list