'html entities cause SGMLParser to call handle_data hook twice'

def test_restrict_xpaths_concat_in_handle_data(self):

    body = '<html><body><div><a    href="/foo">&gt;\xbe\xa9&lt;\xb6\xab</a></body></html>'
    response = HtmlResponse('http://example.org', body=body, encoding='gb18030')
    lx = self.extractor_cls(restrict_xpaths='//div')
    self.assertEqual(lx.extract_links(response), [Link(url='http://example.org/foo', text=u'>\u4eac<\u4e1c', fragment='', nofollow=False)])
