How can i ensure that the following html url link is going to return itself with utf-8
encoding?
<meta http-equiv="REFRESH" content="5; URL=http://superhost.gr/files/download?filename={{ filename }}">
As it is now, although the value of filename is being retrieved from Flask as utf-8
it doesn't form the URL link also as utf-8
.
Here is how i'm fetching this value and try to use it to download a file.
# Prepare selected file for download...
if request.args:
filename = request.args.get('filename') # value comes from template url link
filepath = '/static/files/'
return send_from_directory( filepath, filename, as_attachment=True )
I'am trying to generate the link with Jinja2 / Flask under Apache/WSGI mod.
Perhaps Apache under mod_wsgi is causing this issue?!
The error i'am seeing in the browser is:
Bad Request
The browser (or proxy) sent a request that this server could not understand.
The link that is generated according to Chrome's Developer Tool/Network Tab for a a test file with a mixed filename(greek + english) is:
I'm trying to reproduce your issue but I think that you should provide more information.
I've tried the setup below and the file named
Νικόλαος Βέργος.pdf
is correctly returned by/redirect/
.app.py
templates/home.html