Fix filenames for downloadable query results

Filenames conatining spaces ("foo bar.csv") or non-ASCII characters were
garbled when sent to the client.

The filename parameter of the content-disposition header line should only
contain ASCII characters according to spec (RFC 2183). Modern browsers
recognize an additional filename* parameter, which allows specification of
UTF8-encoded file names (RFC 5987).
Merge pull request #322 from s7eph4n/master

Fix filenames for downloadable query results