'Test restrict_xpaths with encodings'

def test_restrict_xpaths_encoding(self):

    html = '<html><head><title>Page    title<title>\n                                                <body><p><a    href="item/12.html">Item    12</a></p>\n                                                <div    class=\'links\'>\n                                                <p><a    href="/about.html">About    us\xa3</a></p>\n                                                </div>\n                                                <div>\n                                                <p><a    href="/nofollow.html">This    shouldn\'t    be    followed</a></p>\n                                                </div>\n                                                </body></html>'
    response = HtmlResponse('http://example.org/somepage/index.html', body=html, encoding='windows-1252')
    lx = self.extractor_cls(restrict_xpaths="//div[@class='links']")
    self.assertEqual(lx.extract_links(response), [Link(url='http://example.org/about.html', text=u'About    us\xa3')])
