14.06.13 02:37, Ezio Melotti написав(ла):
On Tue, Jun 11, 2013 at 5:49 PM, Serhiy Storchaka <storchaka@gmail.com> wrote:
I propose to add "htmlcharrefreplace" error handler which is similar to "xmlcharrefreplace" error handler but use html entity names if possible.
'∀ x∈ℜ'.encode('ascii', 'xmlcharrefreplace') b'∀ x∈ℜ' '∀ x∈ℜ'.encode('ascii', 'htmlcharrefreplace') b'∀ x∈ℜ'
Do you have any use cases for this, or is it just for completeness since we already have xmlcharrefreplace?
In fact, there is no *need* in the "htmlentityreplace" error handler. "xmlcharrefreplace" is enough in most cases, it is faster and its scope is wider. "htmlentityreplace" is only desired for more human readable html. Perhaps it is not worth to register this error handler by default, but I see some people desire it in the stdlib. With regard to non utf-8 encodings of html, of course there are reasons for their use.