Mercurial > emacs
diff lisp/gnus/mm-decode.el @ 107581:1e23ce3cbd8b
2010-03-30 Martin Stjernholm <mast@lysator.liu.se>
* mm-decode.el (mm-add-meta-html-tag): Added option to override the
charset.
* gnus-art.el (gnus-article-browse-html-parts): Force the correct
charset into the <meta> tag when the article is encoded to utf-8.
author | Katsumi Yamaoka <yamaoka@jpl.org> |
---|---|
date | Tue, 30 Mar 2010 04:44:38 +0000 |
parents | 2bfe0d4c1bc7 |
children | afc774335f7e |
line wrap: on
line diff
--- a/lisp/gnus/mm-decode.el Tue Mar 30 04:12:11 2010 +0000 +++ b/lisp/gnus/mm-decode.el Tue Mar 30 04:44:38 2010 +0000 @@ -1258,11 +1258,11 @@ (mm-save-part-to-file handle file) file)))) -(defun mm-add-meta-html-tag (handle &optional charset) +(defun mm-add-meta-html-tag (handle &optional charset force-charset) "Add meta html tag to specify CHARSET of HANDLE in the current buffer. CHARSET defaults to the one HANDLE specifies. Existing meta tag that -specifies charset will not be modified. Return t if meta tag is added -or replaced." +specifies charset will not be modified unless FORCE-CHARSET is non-nil. +Return t if meta tag is added or replaced." (when (equal (mm-handle-media-type handle) "text/html") (when (or charset (setq charset (mail-content-type-get (mm-handle-type handle) @@ -1274,7 +1274,8 @@ (if (re-search-forward "\ <meta\\s-+http-equiv=[\"']?content-type[\"']?\\s-+content=[\"']\ text/\\(\\sw+\\)\\(?:\;\\s-*charset=\\(.+\\)\\)?[\"'][^>]*>" nil t) - (if (and (match-beginning 2) + (if (and (not force-charset) + (match-beginning 2) (string-match "\\`html\\'" (match-string 1))) ;; Don't modify existing meta tag. nil