This commit implements https://tools.ietf.org/html/rfc2231#section-4 in
order to support sending unicode characters. Tested on both Firefox and
Chromium under Linux.
This adds unidecode as a dependency, which might be relaxed by using
.encode('latin-1', 'ignore') but wouldn't be as useful.
Also, added a test for the correct headers to be added.
Previously, using a filename parameter to send_file with unicode characters, it
failed with the next error since HTTP headers don't allow non latin-1 characters.
Error on request:
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/werkzeug/serving.py", line 193, in run_wsgi
execute(self.server.app)
File "/usr/lib/python3.6/site-packages/werkzeug/serving.py", line 186, in execute
write(b'')
File "/usr/lib/python3.6/site-packages/werkzeug/serving.py", line 152, in write
self.send_header(key, value)
File "/usr/lib64/python3.6/http/server.py", line 509, in send_header
("%s: %s\r\n" % (keyword, value)).encode('latin-1', 'strict'))
UnicodeEncodeError: 'latin-1' codec can't encode character '\uff0f' in position 58: ordinal not in range(256)
Fixes#1286