Python Flask, how to set 'Content-Type' for static files (js)?
Question: For my Flask app I use 'windows-1251' encoding. To draw a template I set
'Content-Type' as follows:

    
    
    from flask.helpers import make_response
    
    def render_tmpl_dummy():
        response = make_response("Some Russian text here")
        response.headers['Content-Type'] = 'text/html; charset=windows-1251'
        return response
    

And all fine here. But my static js-files also in 'windows-1251'. So, is there
any way to set `'Content-Type=application/x-javascript; charset=windows-1251'`
for all static files? (PS: I do not want to convert them to UTF-8 manually in
advance, this method is not suitable for me)


Answer: Your static files shouldn't be served by the web server other than in
development, so converting the file encoding is the **correct** method.

If your reason for not converting the files first is due to volume, see [How
to convert a file to utf-8 in
Python?](http://stackoverflow.com/questions/191359/how-to-convert-a-file-to-
utf-8-in-python) to see how to automate it.

