You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Refactor HTMLParser.unescape to use html.entities.html5 #59361
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee='https://github.com/ezio-melotti'closed_at=<Date2012-06-24.20:05:35.901>created_at=<Date2012-06-24.02:45:42.758>labels= ['type-feature', 'library']
title='Refactor HTMLParser.unescape to use html.entities.html5'updated_at=<Date2012-06-24.20:05:35.899>user='https://github.com/ezio-melotti'
HTMLParser has an internal method called unescape [0] used to convert named character references to the equivalent characters, and it does so by using html.entities.name2codepoint to recreate the equivalent of html.entities.entityrefs with the addition of '.
Now that the html5 entities have been added to html.entities, the parser should use them instead of name2codepoint.
Activity
ezio-melotti commentedon Jun 24, 2012
HTMLParser has an internal method called unescape [0] used to convert named character references to the equivalent characters, and it does so by using html.entities.name2codepoint to recreate the equivalent of html.entities.entityrefs with the addition of '.
Now that the html5 entities have been added to html.entities, the parser should use them instead of name2codepoint.
[0]: see Lib/html/parser.py:500
ezio-melotti commentedon Jun 24, 2012
Here's a patch, please review.
ezio-melotti commentedon Jun 24, 2012
Patch updated after the review.
python-dev commentedon Jun 24, 2012
New changeset 0d53703b1a99 by Ezio Melotti in branch 'default':
bpo-15156: HTMLParser now uses the new "html.entities.html5" dictionary.
http://hg.python.org/cpython/rev/0d53703b1a99
ezio-melotti commentedon Jun 24, 2012
Fixed, thanks for the reviews!