如何在包含UTF-8字符的HTML邮件上使用Emacs Gnus,并使用Lynx作为HTML呈现程序?

如何在包含UTF-8字符的HTML邮件上使用Emacs Gnus,并使用Lynx作为HTML呈现程序?,emacs,utf-8,lynx,gnus,Emacs,Utf 8,Lynx,Gnus,我将GNU Emacs 24.2.1(但在never Emacs上它也不工作)与Gnus v5.13一起使用,并将其配置为使用Lynx格式化HTML邮件: (setq 'mm-text-html-renderer 'lynx) (setcdr (assoc 'lynx mm-text-html-renderer-alist) '(mm-inline-render-with-stdin nil "lynx" "-dump" "-force_html" "-std

我将GNU Emacs 24.2.1(但在never Emacs上它也不工作)与Gnus v5.13一起使用,并将其配置为使用Lynx格式化HTML邮件:

(setq 'mm-text-html-renderer 'lynx)
(setcdr (assoc 'lynx mm-text-html-renderer-alist)
        '(mm-inline-render-with-stdin
          nil "lynx" "-dump" "-force_html" "-stdin" "-display_charset=UTF-8"))
但UTF-8字符显示不正确,例如,我看到类似的情况:

Es gibt \303\274ber 700 neue Top-Level-Domains.
使用以下命令可以轻松解决此问题:

(toggle-read-only)
(recode-region (point-min) (point-max) 'utf-8 'utf-8)
但是有没有可能让GNU将Lynx的输出解释为UTF-8呢

(这个问题在这里也被问到了,但没有回答:
)

我自己找到了答案,下面是使用UTF-8激活Gnus中Lynx的完整代码:

(require 'mm-view)
(setq mm-text-html-renderer 'lynx)
(setcdr (assoc 'lynx mm-text-html-renderer-alist)
        '(mm-inline-render-with-stdin
          nil "lynx" "-dump" "-force_html" "-stdin" "-display_charset=UTF-8"))

(defvar mm-insert-inline-use-utf-8 nil)

(defadvice mm-insert-inline (around mm-insert-inline-utf-8)
  (let ((x (point)))
    (prog1 (progn ad-do-it)
      (when mm-insert-inline-use-utf-8
        (decode-coding-region x (point-max) 'utf-8)))))
(ad-activate 'mm-insert-inline)

(defadvice mm-inline-text-html (around mm-inline-text-html-utf-8)
  (let ((mm-insert-inline-use-utf-8 t))
    ad-do-it))
(ad-activate 'mm-inline-text-html)

也许您可以为
lynx
调用设置编码系统?甚至对于所有子进程?Lynx被设置为UTF-8(
display\u charset
参数和右区域设置变量也被设置),但Gnus在函数
mm inline render with stdin
中读取它,并使用宏
mm with unibyte buffer
,因此忽略程序的字符集。