scrapy/scrapy — pull request #664 by yyl (2014-03-21 03:50:07+00:00)
Title: Add type conversion and encoding for non-str message for msg() in log.py

If `message` variable is a non-str variable such as list or dict containing unicode basestring, then `log.msg(message, level=log.INFO)` will print out raw unicode, instead of the unicode basestring.

Example:

If `s = [u'

Любовь константинов Голощапова - Надежда ����������� | LinkedIn

']`, then `log.msg(s, level=log.INFO)` or `log.msg(str(s), level=log.INFO)` prints out `[u'

\u041b\u044e\u0431\u043e\u0432\u044c...[skipped]...\ufffd\ufffd\ufffd | LinkedIn

']`.

Therefore I added two `isinstance` check for `message` variable in `def msg` in `log.py`, and to convert `message` to unicode basestring if it is not. After that, `log.msg()` will print out correct unicode basestring.

The patch passed the original test suite.