Gnus development mailing list
 help / color / mirror / Atom feed
From: Katsumi Yamaoka <yamaoka@jpl.org>
To: ding@gnus.org
Subject: Re: (Re-)coding problems forwarding calendar attachment
Date: Fri, 24 Aug 2007 19:22:41 +0900	[thread overview]
Message-ID: <b4mr6lt9qq6.fsf@jpl.org> (raw)
In-Reply-To: <87y7g2p8ys.fsf@obelix.mork.no>

[-- Attachment #1: Type: text/plain, Size: 1977 bytes --]

>>>>> Bjørn Mork wrote:
> Katsumi Yamaoka <yamaoka@jpl.org> writes:

>> I've modified Gnus so as to use UTF-8 by default for decoding
>> text/calender parts.

> Probably good, but may cause problems with pre-RFC (version 1.0)
> text/calendar parts.  Let's hope everybody using those were sending
> strict US-ASCII (possibly using QP to encode other charsets)

Well, if the text/calendar part is encoded by arbitrary charset
other than UTF-8 but has no charset spec in the Content-Type
header, there will be no way to detect it automatically.  Though,
we can guess it and apply it through the `K C' command.

> But it still doesn't work.  The attachment is encoded as
> quoted-printable and gets this header:

>  Content-Type: text/calendar; charset=iso-8859-1; name=meeting.ics
>  Content-Transfer-Encoding: quoted-printable

> But it is not converted from utf-8, so that 'æ' is coded as '=C3=A6',
> 'å' as '=C3=A5' etc.

> Everything would have been fine if Gnus had just used

>  Content-Type: text/calendar; charset=utf-8; name=meeting.ics
>  Content-Transfer-Encoding: quoted-printable

> Any idea where this confusion comes from?

I probably have understood what is a prerequisite when one hands
iCalendar files to others.  The text/calendar part that has been
encoded by the iso-8859-1 charset is indeed a valid MIME message.
However, when a recipient saves the part in a file and passes it
to the calendar program, or passes it to the program through the
pipe, the charset is unlikely to be notified to the program.
Therefor, there needs to be an implicit agreement.  That is just
UTF-8, isn't it?

I've changed Gnus' encoder so that UTF-8 is most preferred when
encoding text/calendar parts.  Actually, now Gnus will never use
the charset other than UTF-8.

It is not a matter that the Content-Transfer-Encoding is QP or
base64, is it?  Gnus may use base64 as the case may be.  If it
has to always be QP, I have a plan:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 1071 bytes --]

--- mml.el~	2007-08-24 08:17:16 +0000
+++ mml.el	2007-08-24 10:18:56 +0000
@@ -535,15 +535,18 @@
 			;; insert a "; format=flowed" string unless the
 			;; user has already specified it.
 			(setq flowed (null (assq 'format cont)))))
-		    ;; Prefer `utf-8' for text/calendar parts.
+		    ;; Prefer `utf-8' and QP for text/calendar parts.
 		    (if (or charset
 			    (not (string= type "text/calendar")))
-			(setq charset (mm-encode-body charset))
+			(setq charset (mm-encode-body charset)
+			      encoding (mm-body-encoding
+					charset (cdr (assq 'encoding cont))))
 		      (let ((mm-coding-system-priorities
 			     (cons 'utf-8 mm-coding-system-priorities)))
-			(setq charset (mm-encode-body))))
-		    (setq encoding (mm-body-encoding
-				    charset (cdr (assq 'encoding cont))))))
+			(setq charset (mm-encode-body)
+			      encoding (mm-body-encoding
+					charset (or (cdr (assq 'encoding cont))
+						    'quoted-printable)))))))
 		  (setq coded (buffer-string)))
 		(mml-insert-mime-headers cont type charset encoding flowed)
 		(insert "\n")

[-- Attachment #3: Type: text/plain, Size: 71 bytes --]

P.S.
I will be inactive in the net for a week because of the holidays.

      reply	other threads:[~2007-08-24 10:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-22 12:56 Bjørn Mork
2007-08-23  4:42 ` Katsumi Yamaoka
2007-08-23 15:27   ` Bjørn Mork
2007-08-24 10:22     ` Katsumi Yamaoka [this message]

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

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

  git send-email \
    --in-reply-to=b4mr6lt9qq6.fsf@jpl.org \
    --to=yamaoka@jpl.org \
    --cc=ding@gnus.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.
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 NNTP newsgroup(s).