A similar issue was fixed in scrapy 1.1.1: https://github.com/scrapy/scrapy/pull/2038, but it is still a problem in `w3lib.url.safe_url_string`.