Gnus development mailing list
 help / color / mirror / Atom feed
From: Uwe Brauer <oub@mat.ucm.es>
To: ding@gnus.org
Subject: [SOLVED] (was: coding problem UTF8)
Date: Fri, 30 Nov 2012 22:29:25 +0100	[thread overview]
Message-ID: <87wqx26aq2.fsf_-_@mat.ucm.es> (raw)
In-Reply-To: <871ufbf9sg.fsf_-_@gilgamesch.quim.ucm.es>



   > I hope the bad encoded UTF8 chars reach the group 
   > I have á etc instead of à
   > So I have to run 
   > (decode-coding-region start end 'utf-8 nil)


The following modification works for me:

(defun dsg-icalendar-handle-part (handle)
  (when (equal (car (mm-handle-type handle)) "text/calendar")
    (with-temp-buffer
      (insert (mm-get-part handle))
      (if (equal (mm-handle-encoding handle) 'uuencode)
		  (uudecode-decode-region-internal (point-min) (point-max)))
      (goto-char (point-min))
			(decode-coding-region (point-min) (point-max) 'utf-8 nil)
      (let* ((e
			  (car (icalendar--all-events (icalendar--read-element nil
																   nil))))
			 (subject (icalendar--convert-string-for-import
					   (or (icalendar--get-event-property e 'SUMMARY)
						   "No Subject")))
			 (dtstart (icalendar--get-event-property e 'DTSTART))
			 (dtstart-dec (icalendar--decode-isodatetime dtstart))
			 (start-d (icalendar--datetime-to-diary-date dtstart-dec))
			 (start-t (icalendar--datetime-to-colontime dtstart-dec))
			 (repq (icalendar--get-event-property e 'RRULE)))
		(if (y-or-n-p
			 (format
			  "Add %s for \"%s\" on %s at %s to diary? "
			  (if repq "repeating event" "appointment")
			  subject start-d start-t))
		  (icalendar-import-buffer
	     (expand-file-name (if repq "~/repeating-diary"
				 "~/ical-diary")) t nil))))))

Uwe 




      reply	other threads:[~2012-11-30 21:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-28 22:47 icalendar.el and gnus Uwe Brauer
2012-11-30  3:21 ` Dave Goldberg
2012-11-30 14:24   ` coding problem UTF8 (was: icalendar.el and gnus.) Uwe Brauer
2012-11-30 21:29     ` Uwe Brauer [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=87wqx26aq2.fsf_-_@mat.ucm.es \
    --to=oub@mat.ucm.es \
    --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).