File tree Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -65,6 +65,10 @@ def test_illegal_entities(self):
6565 self .assertEqual (replace_entities ("x≤y" ), "x\u2264 y" )
6666 self .assertEqual (replace_entities ("xy" ), "xy" )
6767 self .assertEqual (replace_entities ("xy" , remove_illegal = False ), "xy" )
68+ self .assertEqual (replace_entities ("�" ), "" )
69+ self .assertEqual (
70+ replace_entities ("�" , remove_illegal = False ), "�"
71+ )
6872
6973 def test_browser_hack (self ):
7074 # check browser hack for numeric character references in the 80-9F range
Original file line number Diff line number Diff line change @@ -91,7 +91,7 @@ def convert_entity(m: Match) -> str:
9191 return bytes ((number ,)).decode ("cp1252" )
9292 else :
9393 return chr (number )
94- except ValueError :
94+ except ( ValueError , OverflowError ) :
9595 pass
9696
9797 return "" if remove_illegal and groups .get ("semicolon" ) else m .group (0 )
You can’t perform that action at this time.
0 commit comments