Improved parsing of Content-Disposition header.

It now tries to detect whether UTF-8 encoding is used.
Closes #745