Clean up step 7 of HTML5 legacy parsing.

This is ugly and hacky because of the differences between "wide" and
"narrow" Python builds (see comments).