From: Katsumi Yamaoka <yamaoka@jpl.org>
To: ding@gnus.org
Subject: Re: one rfc2047-encode error halts entire gnus-group-get-new-news run
Date: Fri, 06 Aug 2010 12:44:37 +0900 [thread overview]
Message-ID: <b4md3two15m.fsf@jpl.org> (raw)
In-Reply-To: <874of8646r.fsf@jidanni.org>
[-- Attachment #1: Type: text/plain, Size: 1537 bytes --]
jidanni@jidanni.org wrote:
> My entire
> g runs the command gnus-group-get-new-news
> run was halted midway upon reaching
> http://radioscanningtw.wikia.com/index.php?title=%E7%89%B9%E6%AE%8A:%E6%9C%80%E8%BF%91%E6%9B%B4%E6%94%B9&feed=rss
> nnrss: Requesting WIKIA Taiwan Radio Scanning Wiki - 近期變動 [zh-tw]...
> rfc2047-encode: Can't rfc2047-encode `使用者:Ɩ\271富裕'
> Why should one little error bring the entire gnus-group-get-new-news run
> to a halt?
> nnrss-version "nnrss 1.0"
That can happen when not only running `gnus-group-get-new-news'
in a nnrss group if there are funny characters in text to be MIME
encoded. `rfc2047-encode' uses `mm-find-mime-charset-region' to
determine charset that is used to encode text, and expects that
it returns a list of single valid charset. However, as the case
may be, it may return a list containing an invalid charset
(actually `nil') or just a list containing a single `nil'.
(with-temp-buffer
(insert "使用者:Ɩ\271富裕")
(mm-find-mime-charset-region (point-min) (point-max)))
=> (nil iso-2022-jp)
(The result will vary according to the language environment.)
In the most case it returns `utf-8' nowadays, but the `nil'
element in the result means there is a character that cannot be
encoded by any charset. For such a case, I've modified
`rfc2047-encode' so as to use `utf-8' as a last resort (the diff
follows). It is no more than a workaround, i.e. some characters
may be encoded irreversibly, but cannot help it.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 522 bytes --]
--- rfc2047.el~ 2010-05-25 07:23:25 +0000
+++ rfc2047.el 2010-08-06 03:36:22 +0000
@@ -655,6 +655,9 @@
Point moves to the end of the region."
(let ((mime-charset (or (mm-find-mime-charset-region b e) (list 'us-ascii)))
cs encoding tail crest eword)
+ ;; Use utf-8 as a last resort if determining charset of text fails.
+ (if (memq nil mime-charset)
+ (setq mime-charset (list 'utf-8)))
(cond ((> (length mime-charset) 1)
(error "Can't rfc2047-encode `%s'"
(buffer-substring-no-properties b e)))
prev parent reply other threads:[~2010-08-06 3:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-05 23:16 jidanni
2010-08-06 3:44 ` 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=b4md3two15m.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).