Gnus development mailing list
 help / color / mirror / Atom feed
* one rfc2047-encode error halts entire gnus-group-get-new-news run
@ 2010-08-05 23:16 jidanni
  2010-08-06  3:44 ` Katsumi Yamaoka
  0 siblings, 1 reply; 2+ messages in thread
From: jidanni @ 2010-08-05 23:16 UTC (permalink / raw)
  To: ding

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"



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: one rfc2047-encode error halts entire gnus-group-get-new-news run
  2010-08-05 23:16 one rfc2047-encode error halts entire gnus-group-get-new-news run jidanni
@ 2010-08-06  3:44 ` Katsumi Yamaoka
  0 siblings, 0 replies; 2+ messages in thread
From: Katsumi Yamaoka @ 2010-08-06  3:44 UTC (permalink / raw)
  To: ding

[-- 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)))

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-08-06  3:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-05 23:16 one rfc2047-encode error halts entire gnus-group-get-new-news run jidanni
2010-08-06  3:44 ` Katsumi Yamaoka

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).