[Python-ideas] Add "htmlcharrefreplace" error handler

Stefan Drees stefan at drees.name
Fri Jun 14 13:53:11 CEST 2013


On 2013-06-14 13:35 CEST, Antoine Pitrou wrote:
> On Fri, 14 Jun 2013 13:31:43 +0200
> Stefan Drees ... wrote:
>
>> On 2013-06-14.06 13:20, Antoine Pitrou wrote:
>>> On Fri, 14 Jun 2013 07:17:00 -0400
>>> Alexander Belopolsky...wrote:
>>>> On Fri, Jun 14, 2013 at 6:11 AM, M.-A. Lemburg ... wrote:
>>>>
>>>>> I think you are forgetting that the output of such a codec
>>>>> is not necessarily always meant for sending over the wire
>>>>> to some browser. It may well be used for creating data which
>>>>> then has to be manipulated by other tools or humans.
>>>>>
>>>>
>>>> +1
>>>>
>>>> On top of that, even HTML that is sent over the wire to a browser may end
>>>> up being read by a human.  It is for a good reason that every browser has a
>>>> view source option more or less readily available.
>>>
>>> If you want to *read* HTML (not write it), then you certainly want the
>>> original Unicode characters, not the garbled HTML entities meant to
>>> represent them.
>>
>> yes when everything just works and as a consumer, but then as the
>> producers we are  :-) in the midst of a review session a debugging
>> attempt or when seeking a workaround, the view ascii source level of
>> about any platform comes in quite handy ...
>
> Perhaps it does, but that's not a reason to add an error handler to
> Python. If you want debug output, you should write your own debug
> routines (or, you can simply display the HTML's repr()).
>
> So I still agree with Ezio: the function may be useful as part of the
> stdlib, but it doesn't have to be an encoding error handler.

+1 based on that summarizing evaluation ... surprisingly I will have to 
continue writing my own debug routines ;-)


All the best,

Stefan.


More information about the Python-ideas mailing list