emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r99770: 2010-03-30 Martin Stjernholm


From: Katsumi Yamaoka
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r99770: 2010-03-30 Martin Stjernholm <address@hidden>
Date: Tue, 30 Mar 2010 04:46:45 +0000
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 99770 [merge]
committer: Katsumi Yamaoka <address@hidden>
branch nick: trunk
timestamp: Tue 2010-03-30 04:46:45 +0000
message:
  2010-03-30  Martin Stjernholm  <address@hidden>
   * 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.
modified:
  lisp/gnus/ChangeLog
  lisp/gnus/gnus-art.el
  lisp/gnus/mm-decode.el
=== modified file 'lisp/gnus/ChangeLog'
--- a/lisp/gnus/ChangeLog       2010-03-30 04:03:00 +0000
+++ b/lisp/gnus/ChangeLog       2010-03-30 04:44:38 +0000
@@ -1,3 +1,11 @@
+2010-03-30  Martin Stjernholm  <address@hidden>
+
+       * 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.
+
 2010-03-30  Katsumi Yamaoka  <address@hidden>
 
        * gnus-art.el (gnus-article-browse-delete-temp-files): Delete

=== modified file 'lisp/gnus/gnus-art.el'
--- a/lisp/gnus/gnus-art.el     2010-03-30 04:03:00 +0000
+++ b/lisp/gnus/gnus-art.el     2010-03-30 04:44:38 +0000
@@ -2893,7 +2893,8 @@
             ;; Add a meta html tag to specify charset and a header.
             (cond
              (header
-              (let (title eheader body hcharset coding cid-image-dir)
+              (let (title eheader body hcharset coding force-charset
+                          cid-image-dir)
                 (with-temp-buffer
                   (mm-enable-multibyte)
                   (setq case-fold-search t)
@@ -2917,7 +2918,8 @@
                             title (when title
                                     (mm-encode-coding-string title charset))
                             body (mm-encode-coding-string (mm-get-part handle)
-                                                          charset))
+                                                          charset)
+                            force-charset t)
                     (setq hcharset (mm-find-mime-charset-region (point-min)
                                                                 (point-max)))
                     (cond ((= (length hcharset) 1)
@@ -2948,7 +2950,8 @@
                                       body (mm-encode-coding-string
                                             (mm-decode-coding-string
                                              (mm-get-part handle) body)
-                                            charset))))
+                                            charset)
+                                      force-charset t)))
                           (setq charset hcharset
                                 eheader (mm-encode-coding-string
                                          (buffer-string) coding)
@@ -2962,7 +2965,7 @@
                   (mm-disable-multibyte)
                   (insert body)
                   (when charset
-                    (mm-add-meta-html-tag handle charset))
+                    (mm-add-meta-html-tag handle charset force-charset))
                   (when title
                     (goto-char (point-min))
                     (unless (search-forward "<title>" nil t)

=== modified file 'lisp/gnus/mm-decode.el'
--- a/lisp/gnus/mm-decode.el    2010-03-29 10:16:37 +0000
+++ b/lisp/gnus/mm-decode.el    2010-03-30 04:44:38 +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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]