Fix encoding issues created when adding Python 3 support.

Filters should always return a byte string (str in 2, bytes in 3) to work
with Django's File API. Added tests for properly filtering unicode files.