diff options
| -rw-r--r-- | lisp/gnus/ChangeLog | 8 | ||||
| -rw-r--r-- | lisp/gnus/gnus-art.el | 11 | ||||
| -rw-r--r-- | lisp/gnus/mm-decode.el | 9 |
3 files changed, 20 insertions, 8 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 5fddceec0fb..66a358af534 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2010-03-30 Martin Stjernholm <mast@lysator.liu.se> | ||
| 2 | |||
| 3 | * mm-decode.el (mm-add-meta-html-tag): Added option to override the | ||
| 4 | charset. | ||
| 5 | |||
| 6 | * gnus-art.el (gnus-article-browse-html-parts): Force the correct | ||
| 7 | charset into the <meta> tag when the article is encoded to utf-8. | ||
| 8 | |||
| 1 | 2010-03-30 Katsumi Yamaoka <yamaoka@jpl.org> | 9 | 2010-03-30 Katsumi Yamaoka <yamaoka@jpl.org> |
| 2 | 10 | ||
| 3 | * gnus-art.el (gnus-article-browse-delete-temp-files): Delete | 11 | * gnus-art.el (gnus-article-browse-delete-temp-files): Delete |
diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el index 9288101759f..086eb47d76c 100644 --- a/lisp/gnus/gnus-art.el +++ b/lisp/gnus/gnus-art.el | |||
| @@ -2893,7 +2893,8 @@ message header will be added to the bodies of the \"text/html\" parts." | |||
| 2893 | ;; Add a meta html tag to specify charset and a header. | 2893 | ;; Add a meta html tag to specify charset and a header. |
| 2894 | (cond | 2894 | (cond |
| 2895 | (header | 2895 | (header |
| 2896 | (let (title eheader body hcharset coding cid-image-dir) | 2896 | (let (title eheader body hcharset coding force-charset |
| 2897 | cid-image-dir) | ||
| 2897 | (with-temp-buffer | 2898 | (with-temp-buffer |
| 2898 | (mm-enable-multibyte) | 2899 | (mm-enable-multibyte) |
| 2899 | (setq case-fold-search t) | 2900 | (setq case-fold-search t) |
| @@ -2917,7 +2918,8 @@ message header will be added to the bodies of the \"text/html\" parts." | |||
| 2917 | title (when title | 2918 | title (when title |
| 2918 | (mm-encode-coding-string title charset)) | 2919 | (mm-encode-coding-string title charset)) |
| 2919 | body (mm-encode-coding-string (mm-get-part handle) | 2920 | body (mm-encode-coding-string (mm-get-part handle) |
| 2920 | charset)) | 2921 | charset) |
| 2922 | force-charset t) | ||
| 2921 | (setq hcharset (mm-find-mime-charset-region (point-min) | 2923 | (setq hcharset (mm-find-mime-charset-region (point-min) |
| 2922 | (point-max))) | 2924 | (point-max))) |
| 2923 | (cond ((= (length hcharset) 1) | 2925 | (cond ((= (length hcharset) 1) |
| @@ -2948,7 +2950,8 @@ message header will be added to the bodies of the \"text/html\" parts." | |||
| 2948 | body (mm-encode-coding-string | 2950 | body (mm-encode-coding-string |
| 2949 | (mm-decode-coding-string | 2951 | (mm-decode-coding-string |
| 2950 | (mm-get-part handle) body) | 2952 | (mm-get-part handle) body) |
| 2951 | charset)))) | 2953 | charset) |
| 2954 | force-charset t))) | ||
| 2952 | (setq charset hcharset | 2955 | (setq charset hcharset |
| 2953 | eheader (mm-encode-coding-string | 2956 | eheader (mm-encode-coding-string |
| 2954 | (buffer-string) coding) | 2957 | (buffer-string) coding) |
| @@ -2962,7 +2965,7 @@ message header will be added to the bodies of the \"text/html\" parts." | |||
| 2962 | (mm-disable-multibyte) | 2965 | (mm-disable-multibyte) |
| 2963 | (insert body) | 2966 | (insert body) |
| 2964 | (when charset | 2967 | (when charset |
| 2965 | (mm-add-meta-html-tag handle charset)) | 2968 | (mm-add-meta-html-tag handle charset force-charset)) |
| 2966 | (when title | 2969 | (when title |
| 2967 | (goto-char (point-min)) | 2970 | (goto-char (point-min)) |
| 2968 | (unless (search-forward "<title>" nil t) | 2971 | (unless (search-forward "<title>" nil t) |
diff --git a/lisp/gnus/mm-decode.el b/lisp/gnus/mm-decode.el index 58ba3ec7413..171afac31ff 100644 --- a/lisp/gnus/mm-decode.el +++ b/lisp/gnus/mm-decode.el | |||
| @@ -1258,11 +1258,11 @@ PROMPT overrides the default one used to ask user for a file name." | |||
| 1258 | (mm-save-part-to-file handle file) | 1258 | (mm-save-part-to-file handle file) |
| 1259 | file)))) | 1259 | file)))) |
| 1260 | 1260 | ||
| 1261 | (defun mm-add-meta-html-tag (handle &optional charset) | 1261 | (defun mm-add-meta-html-tag (handle &optional charset force-charset) |
| 1262 | "Add meta html tag to specify CHARSET of HANDLE in the current buffer. | 1262 | "Add meta html tag to specify CHARSET of HANDLE in the current buffer. |
| 1263 | CHARSET defaults to the one HANDLE specifies. Existing meta tag that | 1263 | CHARSET defaults to the one HANDLE specifies. Existing meta tag that |
| 1264 | specifies charset will not be modified. Return t if meta tag is added | 1264 | specifies charset will not be modified unless FORCE-CHARSET is non-nil. |
| 1265 | or replaced." | 1265 | Return t if meta tag is added or replaced." |
| 1266 | (when (equal (mm-handle-media-type handle) "text/html") | 1266 | (when (equal (mm-handle-media-type handle) "text/html") |
| 1267 | (when (or charset | 1267 | (when (or charset |
| 1268 | (setq charset (mail-content-type-get (mm-handle-type handle) | 1268 | (setq charset (mail-content-type-get (mm-handle-type handle) |
| @@ -1274,7 +1274,8 @@ or replaced." | |||
| 1274 | (if (re-search-forward "\ | 1274 | (if (re-search-forward "\ |
| 1275 | <meta\\s-+http-equiv=[\"']?content-type[\"']?\\s-+content=[\"']\ | 1275 | <meta\\s-+http-equiv=[\"']?content-type[\"']?\\s-+content=[\"']\ |
| 1276 | text/\\(\\sw+\\)\\(?:\;\\s-*charset=\\(.+\\)\\)?[\"'][^>]*>" nil t) | 1276 | text/\\(\\sw+\\)\\(?:\;\\s-*charset=\\(.+\\)\\)?[\"'][^>]*>" nil t) |
| 1277 | (if (and (match-beginning 2) | 1277 | (if (and (not force-charset) |
| 1278 | (match-beginning 2) | ||
| 1278 | (string-match "\\`html\\'" (match-string 1))) | 1279 | (string-match "\\`html\\'" (match-string 1))) |
| 1279 | ;; Don't modify existing meta tag. | 1280 | ;; Don't modify existing meta tag. |
| 1280 | nil | 1281 | nil |