unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Austin Clements <amdragon@MIT.EDU>
To: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>
Cc: notmuch@notmuchmail.org
Subject: Re: [PATCH] Output unmodified Content-Type header value for JSON format.
Date: Sat, 19 Nov 2011 13:58:18 -0500	[thread overview]
Message-ID: <20111119185818.GR9351@mit.edu> (raw)
In-Reply-To: <87ty60pts9.fsf@gmail.com>

Quoth Dmitry Kurochkin on Nov 19 at  9:26 am:
> On Fri, 18 Nov 2011 23:59:57 -0500, Austin Clements <amdragon@MIT.EDU> wrote:
> > Quoth Dmitry Kurochkin on Nov 19 at  6:42 am:
> > > Hi Jamie.
> > > 
> > > On Fri, 18 Nov 2011 17:58:52 -0800, Jameson Graef Rollins <jrollins@finestructure.net> wrote:
> > > > On Sat, 19 Nov 2011 03:45:05 +0400, Dmitry Kurochkin <dmitry.kurochkin@gmail.com> wrote:
> > > > > Before the change, notmuch used g_mime_content_type_to_string(3)
> > > > > function to output Content-Type header value.  Turns out it outputs
> > > > > only "type/subtype" part and ignores all parameters.  Also, if there
> > > > > is no Content-Type header, default "text/plain" value is used.
> > > > 
> > > > Hi, Dmitry.  Can you explain under what circumstances you would need the
> > > > extra content-type parameters?
> > > 
> > > Charset is an example of a parameter which you need to render a part
> > > correctly.
> > 
> > Can notmuch convert to a common charset, given that, otherwise, every
> > client is going to have to implement this conversion anyway?
> > 
> 
> Notmuch can handle charset (and any other) parameters but only for known
> media types (i.e. text/*).  I think it would be useful (especially for
> human-readable output formats).  But it is a separate issue.
> 
> Notmuch can not convert other types it does not know how to handle.
> E.g. HTML charset conversion is not as simple as for plain text.
> 
> AFAIK standard defines charset parameter just for few types.  So in
> general, charset parameter can have any meaning for some custom media
> type.

Interesting.  I hadn't realized the content-type specification was so
open-ended.  However, there are many things that *could* be included
in the JSON format but aren't; what's included is primarily driven by
what consumers actually need and it seems like the actual need here is
charset handling.  Maybe the JSON format *shouldn't* evolve this way,
but I think it should either be driven by its needs like it is now, or
we should be taking bigger steps like providing *all* of the headers
(essentially, a JSON-ification of the MIME structure), which would
subsume more specific generalizations like exposing just the full
content-type header.

Regarding charset, specifically, though, the JSON format only includes
part bodies for text/* types and, according to RFC 2045,

  For example, the "charset" parameter is applicable to any subtype of
  "text", ...

Section 4.1.2 (Charset Parameter) of RFC 2046 beats around the bush,
but I think it's saying essentially the same thing in a lot more
detail.  Given that, I think it does make sense for notmuch to handle
the charset parameter and re-coding.

> > (And are there other examples of useful things in the content type?)
> 
> What is meant by useful?  All parameters do have some use.  The fact
> that notmuch does not handle them does not mean they are useless.  And
> notmuch can not handle all parameters just because the list of
> parameters is not defined.  So there is no choice but to let notmuch
> users see and use these parameters.

Yes, I now agree with this, modulo my statements about generality above.

> Regards,
>   Dmitry
> 

-- 
Austin Clements                                      MIT/'06/PhD/CSAIL
amdragon@mit.edu                           http://web.mit.edu/amdragon
       Somewhere in the dream we call reality you will find me,
              searching for the reality we call dreams.

  reply	other threads:[~2011-11-19 18:55 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-18 23:45 [PATCH] Output unmodified Content-Type header value for JSON format Dmitry Kurochkin
2011-11-19  1:58 ` Jameson Graef Rollins
2011-11-19  2:42   ` Dmitry Kurochkin
2011-11-19  4:59     ` Austin Clements
2011-11-19  5:26       ` Dmitry Kurochkin
2011-11-19 18:58         ` Austin Clements [this message]
2011-11-20 18:52           ` Dmitry Kurochkin
2011-11-19 10:49     ` Jameson Graef Rollins
2011-11-20 18:32       ` Dmitry Kurochkin
2011-11-20 20:10         ` Jameson Graef Rollins
2011-11-23  3:40           ` Austin Clements
2012-01-12 17:07             ` Pieter Praet
2012-01-12 17:28               ` Austin Clements
2012-01-14  9:19                 ` Pieter Praet
2012-01-15 11:52                   ` David Edmondson
2012-01-15 17:58                     ` Austin Clements
2012-01-16  8:49                       ` David Edmondson
2012-01-16 13:18                         ` Tomi Ollila
2011-11-19  4:18 ` [PATCH v2] " Dmitry Kurochkin
2011-11-19 12:59   ` David Bremner
2011-11-20 18:35     ` Dmitry Kurochkin
2012-01-12 17:08       ` Pieter Praet
2012-01-13  3:16         ` David Bremner
2012-01-14  8:59           ` Pieter Praet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20111119185818.GR9351@mit.edu \
    --to=amdragon@mit.edu \
    --cc=dmitry.kurochkin@gmail.com \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).