[mew-dist 18341] Re: UTF-8 decode failure
Kazu Yamamoto ( 山本和彦 )
kazu at example.com
2001年 8月 2日 (木) 16:36:16 JST
From: Hideyuki SHIRAI (白井秀行) <shirai at example.com>
Subject: [mew-dist 18340] Re: UTF-8 decode failure
> (defun mew-cs-decode-string (str cs)
> (if cs (decode-coding-string str cs) str))
>
> でもいいかもしれないですね。で、どこかの文章に「もし、Mule 4.1
> で Summary や Message の header 文字が変だったら、これを
> ~/.emacs に書いてね。」で、すますとか。
現在、こういうコメントを書いています。
--かず
Index: mew-func.el
===================================================================
RCS file: /cvsroot/mew/mew/mew-func.el,v
retrieving revision 1.13
diff -c -r1.13 mew-func.el
*** mew-func.el 2001/07/08 05:00:37 1.13
--- mew-func.el 2001/08/02 07:07:30
***************
*** 1164,1169 ****
--- 1164,1173 ----
(if (fboundp 'set-buffer-multibyte)
(if mew-unibyte-p () (set-buffer-multibyte arg))))
+ (defsubst mew-multibyte-string-p (str)
+ (when (fboundp 'multibyte-string-p)
+ (if mew-unibyte-p () (multibyte-string-p str))))
+
(defvar mew-unibyte-p
(and (boundp 'enable-multibyte-characters)
(null enable-multibyte-characters)))
Index: mew-mule3.el
===================================================================
RCS file: /cvsroot/mew/mew/mew-mule3.el,v
retrieving revision 1.9
diff -c -r1.9 mew-mule3.el
*** mew-mule3.el 2001/07/25 01:30:44 1.9
--- mew-mule3.el 2001/08/02 07:07:30
***************
*** 130,135 ****
--- 130,136 ----
;;(defun mew-cs-decode-string (str cs)
;; (if cs (decode-coding-string str cs) str))
+ ;; This code should be obsoleted when Mule 4.1 goes away.
(defun mew-cs-decode-string (str cs)
(if (null cs)
str
***************
*** 137,151 ****
ret buf)
(if (null post-conv)
(decode-coding-string str cs)
! ;; Emacs applys post-conv just to a buffer, not to a string.
;; So, we should use a buffer.
(setq buf (generate-new-buffer mew-buffer-prefix))
(save-excursion
(set-buffer buf)
(mew-erase-buffer)
! (mew-set-buffer-multibyte nil)
(insert str)
! (mew-set-buffer-multibyte t)
(decode-coding-region (point-min) (point-max) cs)
(setq ret (buffer-substring (point-min) (point-max))))
(mew-remove-buffer buf)
--- 138,155 ----
ret buf)
(if (null post-conv)
(decode-coding-string str cs)
! ;; Mule 4.1 (Emacs 20.7 + Mule-UCS-0.84) has a bug.
! ;; It applys post-conv just to a buffer, not to a string.
;; So, we should use a buffer.
(setq buf (generate-new-buffer mew-buffer-prefix))
(save-excursion
(set-buffer buf)
(mew-erase-buffer)
! ;; The old base64-decode-string() returns a multibyte string.
! ;; The new base64-decode-string() returns a unibyte string.
! (mew-set-buffer-multibyte (mew-multibyte-string-p str))
(insert str)
! (or (mew-multibyte-string-p str) (mew-set-buffer-multibyte t))
(decode-coding-region (point-min) (point-max) cs)
(setq ret (buffer-substring (point-min) (point-max))))
(mew-remove-buffer buf)
Mew-dist メーリングリストの案内