How to use different encodings for text in HTTP headers

Updated . Posted . Visible to the public.

In order to use different encodings than ASCII for HTTP headers use the following syntax:

Header-Key: Header-Value; Parameter-Name*=utf-8''parameter_value_in_utf8_and_encoded_chars

Concrete example how to use an utf8 encoded filename for file downloads (with fallback):

Content-Disposition: attachment; filename="aepfel"; filename*=utf-8''%c3%a4pfel
Ulrich Berkmüller
Last edit
Keywords
http, utf8, header, encoding, file, download, content, disposition
License
Source code in this card is licensed under the MIT License.
Posted by Ulrich Berkmüller to makandra dev (2011-07-19 10:10)