scrapy/scrapy — pull request #952 by Digenis (2014-11-17 17:41:10+00:00)
Title: encode unicode selector exception

The exception quotes an xpath string
which may be unicode.

When an invalid xpath contains wide characters (eg ```sel.xpath(u'//x[@y="з"/]')```)
they end up verbatim in the exception message (which quotes the xpath).
Unicode strings should be encoded http://bugs.python.org/issue2517
Currently a UnicodeEncodeError (eg ``` UnicodeEncodeError('ascii', u'Invalid XPath: //x[@y="\u0437"/]', 23, 24, 'ordinal not in range(128)')```) hides the original exception.

In this PR I encode the exception message to utf8 and update the relevant test.