diff --git a/scrapy/utils/response.py b/scrapy/utils/response.py index b5d7a58ca..2b7b8544b 100644 --- a/scrapy/utils/response.py +++ b/scrapy/utils/response.py @@ -53,7 +53,10 @@ def response_status_message(status): >>> response_status_message(404) '404 Not Found' """ - return '%s %s' % (status, http.responses.get(int(status))) + # Implicit decode/encode is on purpose to force native strings + # This is properly fixed in Scrapy >=1.1 at revision faf9265 + reason = http.RESPONSES.get(int(status)).decode('utf8', errors='replace') + return '{} {}'.format(status, reason) def response_httprepr(response): """Return raw HTTP representation (as string) of the given response. This