* elmo.el (elmo-message-fetch-string): Disable multibyte.
authorhmurata <hmurata>
Thu, 24 Feb 2005 15:08:11 +0000 (15:08 +0000)
committerhmurata <hmurata>
Thu, 24 Feb 2005 15:08:11 +0000 (15:08 +0000)
* elmo-util.el (elmo-multibypte-buffer-name): New constant.
(elmo-with-enable-multibyte): New macro.

* modb-entity.el (elmo-msgdb-get-decoded-cache): Use it.

elmo/ChangeLog
elmo/elmo-util.el
elmo/elmo.el
elmo/modb-entity.el

index f257dea..5a3728d 100644 (file)
@@ -1,3 +1,12 @@
+2005-02-24  Hiroya Murata  <lapis-lazuli@pop06.odn.ne.jp>
+
+       * elmo.el (elmo-message-fetch-string): Disable multibyte.
+
+       * elmo-util.el (elmo-multibypte-buffer-name): New constant.
+       (elmo-with-enable-multibyte): New macro.
+
+       * modb-entity.el (elmo-msgdb-get-decoded-cache): Use it.
+
 2005-02-23  Hiroya Murata  <lapis-lazuli@pop06.odn.ne.jp>
 
        * elmo-filter.el (elmo-filter-add-flag-count): Removed unused
index 3a5e66d..2f65c3f 100644 (file)
 (def-edebug-spec elmo-bind-directory
   (form &rest form))
 
+(defconst elmo-multibypte-buffer-name " *elmo-multibyte-buffer*")
+
+(defmacro elmo-with-enable-multibyte (&rest body)
+  "Evaluate BODY with `enable-multibyte-character' as non-nil."
+  `(let ((default-enable-multibyte-characters t))
+     (with-current-buffer (get-buffer-create elmo-multibypte-buffer-name)
+       ,@body)))
+
+(put 'elmo-with-enable-multibyte 'lisp-indent-function 0)
+(def-edebug-spec elmo-with-enable-multibyte t)
+
 (defun elmo-object-load (filename &optional mime-charset no-err)
   "Load OBJECT from the file specified by FILENAME.
 File content is decoded with MIME-CHARSET."
index df61b7f..f077837 100644 (file)
@@ -1425,6 +1425,7 @@ If Optional LOCAL is non-nil, don't update server flag."
                                         unread
                                         section)
   (with-temp-buffer
+    (set-buffer-multibyte nil)
     (when (elmo-message-fetch folder number strategy unread section)
       (buffer-string))))
 
index b5fede0..4b9c4da 100644 (file)
@@ -179,14 +179,13 @@ Header region is supposed to be narrowed.")
                              (elmo-make-hash 2048))))
            decoded)
        (or (elmo-get-hash-val string hashtb)
-           (progn
-             (elmo-set-hash-val
-              string
-              (setq decoded
-                    (decode-mime-charset-string string elmo-mime-charset))
-              hashtb)
-             decoded)))
-    (decode-mime-charset-string string elmo-mime-charset)))
+           (prog1
+               (setq decoded
+                     (elmo-with-enable-multibyte
+                       (decode-mime-charset-string string elmo-mime-charset)))
+             (elmo-set-hash-val string decoded hashtb))))
+    (elmo-with-enable-multibyte
+      (decode-mime-charset-string string elmo-mime-charset))))
 
 (defsubst modb-legacy-make-message-entity (args)
   "Make an message entity."