File downloads in Django when file name contains non-ASCII chars.

Unfortunately there is no easy way to encode a file name within the Content-Disposition HTTP header when it contains non-ASCII chars. Meaning, if you are doing the following:

response['Content-Disposition'] = 'attachment; filename=Espanél.txt'

Then you will get an exception from Django when it tries to encode the headers as ASCII. The Content-Disposition header must be fully ASCII, and there is no standard way to encode i18n characters into this header. At least none that browser vendors all implement. The solution is actually quite simple, it involves removing the header altogether and putting the filename into the URL. The browser will cherry-pick the filename

Posted on 27.08.09 | no comments | Filed Under: Uncategorized

Building SphinxSE on Ubuntu 9.04

I pulled some of this information from: http://www.v-nessa.net/2007/07/21/installing-sphinx-for-mysql-51

First of all, you need mysql-server-5.1, so install it:

# sudo apt-get install mysql-server-5.1

And it’s sources:

# sudo apt-get sources mysql-server-5.1

Then you need to get the sphinx tarball, extract it and then copy the mysqlse directory into the storage/ directory within the mysql source directory.

# wget http://www.sphinxsearch.com/downloads/sphinx-0.9.8.1.tar.gz
# tar xzf sphinx-0.9.8.1.tar.gz
# cd mysql-dfsg-5.1-5.1.31/
# cp -R ../../sphinx-0.9.8.1/mysqlse storage/sphinx

For some reason, I could not configure mysql, it was missing the Docs/ directory, so I nabbed the tarball from MySQL and extracted Docs into my debian MySQL source tree.

# wget http://mysql.he.net/Downloads/MySQL-5.1/mysql-5.1.37.tar.gz
# mkdir temp
# tar xzf mysql-5.1.37.tar.gz -C temp
#

Posted on 27.08.09 | no comments | Filed Under: Uncategorized

Pages

Categories


twodoteau would like to use this space to support the following projects:

Firefox 2 Get Thunderbird!