* mm-view.el (mm-inline-text-html-render-with-w3): Check META
authorTSUCHIYA Masatoshi <tsuchiya@namazu.org>
Fri, 7 May 2004 07:36:52 +0000 (07:36 +0000)
committerTSUCHIYA Masatoshi <tsuchiya@namazu.org>
Fri, 7 May 2004 07:36:52 +0000 (07:36 +0000)
tags, only when charsets are not specified in headers.
(mm-inline-text-html-render-with-w3m): Ditto.

* lpath.el: Remove `w3m-meta-content-type-charset-regexp' and
`w3m-charset-to-coding-system'.  Add `w3m-detect-meta-charset'.

lisp/ChangeLog
lisp/lpath.el
lisp/mm-view.el

index e758535..cc003e7 100644 (file)
@@ -1,3 +1,12 @@
+2004-05-07  TSUCHIYA Masatoshi  <tsuchiya@namazu.org>
+
+       * mm-view.el (mm-inline-text-html-render-with-w3): Check META
+       tags, only when charsets are not specified in headers.
+       (mm-inline-text-html-render-with-w3m): Ditto.
+
+       * lpath.el: Remove `w3m-meta-content-type-charset-regexp' and
+       `w3m-charset-to-coding-system'.  Add `w3m-detect-meta-charset'.
+
 2004-05-06  TSUCHIYA Masatoshi  <tsuchiya@namazu.org>
 
        * gnus-art.el (article-strip-banner): Use MIME-encoded from fields
index 6851604..b6fa190 100644 (file)
@@ -20,7 +20,7 @@
               tool-bar-add-item-from-menu tool-bar-local-item-from-menu
               url-generic-parse-url url-http-file-exists-p
               url-insert-file-contents vcard-pretty-print w32-focus-frame
-              w3m-charset-to-coding-system w3m-region x-focus-frame))
+              w3m-detect-meta-charset w3m-region x-focus-frame))
 (maybe-bind '(eudc-protocol
              filladapt-mode mc-pgp-always-sign
              rmail-insert-mime-forwarded-message-function url-current-object
@@ -28,8 +28,7 @@
              w3-meta-charset-content-type-regexp
              w3-meta-content-type-charset-regexp
              w3m-cid-retrieve-function-alist w3m-current-buffer
-             w3m-display-inline-images w3m-meta-content-type-charset-regexp
-             w3m-minor-mode-map))
+             w3m-display-inline-images w3m-minor-mode-map))
 
 (if (featurep 'xemacs)
     (progn
index e88eca5..14ce203 100644 (file)
        (charset (mail-content-type-get
                  (mm-handle-type handle) 'charset)))
     (save-excursion
-      (insert text)
+      (insert (if charset (mm-decode-string text charset) text))
       (save-restriction
        (narrow-to-region b (point))
-       (goto-char (point-min))
-       (if (or (and (boundp 'w3-meta-content-type-charset-regexp)
-                    (re-search-forward
-                     w3-meta-content-type-charset-regexp nil t))
-               (and (boundp 'w3-meta-charset-content-type-regexp)
-                    (re-search-forward
-                     w3-meta-charset-content-type-regexp nil t)))
+       (unless charset
+         (goto-char (point-min))
+         (when (or (and (boundp 'w3-meta-content-type-charset-regexp)
+                        (re-search-forward
+                         w3-meta-content-type-charset-regexp nil t))
+                   (and (boundp 'w3-meta-charset-content-type-regexp)
+                        (re-search-forward
+                         w3-meta-charset-content-type-regexp nil t)))
            (setq charset
-                 (or (let ((bsubstr (buffer-substring-no-properties
-                                     (match-beginning 2)
-                                     (match-end 2))))
-                       (if (fboundp 'w3-coding-system-for-mime-charset)
-                           (w3-coding-system-for-mime-charset bsubstr)
-                         (mm-charset-to-coding-system bsubstr)))
-                     charset)))
-       (delete-region (point-min) (point-max))
-       (insert (mm-decode-string text charset))
+                 (let ((bsubstr (buffer-substring-no-properties
+                                 (match-beginning 2)
+                                 (match-end 2))))
+                   (if (fboundp 'w3-coding-system-for-mime-charset)
+                       (w3-coding-system-for-mime-charset bsubstr)
+                     (mm-charset-to-coding-system bsubstr))))
+           (delete-region (point-min) (point-max))
+           (insert (mm-decode-string text charset))))
        (save-window-excursion
          (save-restriction
            (let ((w3-strict-width width)
        (b (point))
        (charset (mail-content-type-get (mm-handle-type handle) 'charset)))
     (save-excursion
-      (insert text)
+      (insert (if charset (mm-decode-string text charset) text))
       (save-restriction
        (narrow-to-region b (point))
-       (goto-char (point-min))
-       (when (re-search-forward w3m-meta-content-type-charset-regexp nil t)
-         (setq charset (or (w3m-charset-to-coding-system (match-string 2))
-                           charset)))
-       (when charset
-         (delete-region (point-min) (point-max))
-         (insert (mm-decode-string text charset)))
+       (unless charset
+         (goto-char (point-min))
+         (when (setq charset (w3m-detect-meta-charset))
+           (delete-region (point-min) (point-max))
+           (insert (mm-decode-string text charset))))
        (let ((w3m-safe-url-regexp mm-w3m-safe-url-regexp)
              w3m-force-redisplay)
-         (w3m-region (point-min) (point-max)))
+         (w3m-region (point-min) (point-max) nil charset))
        (when (and mm-inline-text-html-with-w3m-keymap
                   (boundp 'w3m-minor-mode-map)
                   w3m-minor-mode-map)