Next: , Previous: rfc2045, Up: Basic Functions

4.2 rfc2231

RFC2231 defines a syntax for the Content-Type and Content-Disposition headers. Its snappy name is MIME Parameter Value and Encoded Word Extensions: Character Sets, Languages, and Continuations.

In short, these headers look something like this:

     Content-Type: application/x-stuff;
      title*0*=us-ascii'en'This%20is%20even%20more%20;
      title*1*=%2A%2A%2Afun%2A%2A%2A%20;
      title*2="isn't it!"

They usually aren't this bad, though.

The following functions are defined by this library:

rfc2231-parse-string
Parse a Content-Type header and return a list describing its elements.
          (rfc2231-parse-string
           "application/x-stuff;
           title*0*=us-ascii'en'This%20is%20even%20more%20;
           title*1*=%2A%2A%2Afun%2A%2A%2A%20;
           title*2=\"isn't it!\"")
          ⇒ ("application/x-stuff"
              (title . "This is even more ***fun*** isn't it!"))

rfc2231-get-value
Takes one of the lists on the format above and returns the value of the specified attribute.
rfc2231-encode-string
Encode a parameter in headers likes Content-Type and Content-Disposition.