Elisa
Elisa

Reputation: 7103

Scrapy problem with international text

I did scraping text from webpage using scrapy. In spider, I have code like:

title = hxs.select("//h1/text()").extract() #1
final_text = title[0].encode('utf-8')   #2

Here problem is line #1 gives [u'Puerto Ban\xfas'] line #2 gives Puerto Ban\xc3\xbas

But original text was Puerto Banús. How can I get this original saved and displayed?

Upvotes: 1

Views: 203

Answers (1)

wRAR
wRAR

Reputation: 25540

>>> print u'Puerto Ban\xfas'
Puerto Banús
>>> print 'Puerto Ban\xc3\xbas'
Puerto Banús

I don't see a problem here.

Upvotes: 1

Related Questions