X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=lisp%2Fmm-bodies.el;h=e4c7894463af98228ab40734e5c66398453b8ee7;hb=47bc3a7ccbdea93f85546cfac45ee9ebdb32d310;hp=b28c50cb182bd2bafa8800b66ab1f7ebd9be05a4;hpb=b57d8c30586c1a281b52d3dc10e99bbb849d298d;p=elisp%2Fgnus.git- diff --git a/lisp/mm-bodies.el b/lisp/mm-bodies.el index b28c50c..e4c7894 100644 --- a/lisp/mm-bodies.el +++ b/lisp/mm-bodies.el @@ -282,14 +282,17 @@ use the supplied charset unconditionally." "Decode region between START and END with CODING-SYSTEM. If CODING-SYSTEM is not a valid coding system for the text, let Emacs decide which coding system to use." - (let* ((decoded (mm-decode-coding-string (buffer-substring start end) - coding-system)) - (charsets (find-charset-string decoded))) - (if (or (memq 'eight-bit-control charsets) - (memq 'eight-bit-graphic charsets)) - (mm-decode-coding-region start end 'undecided) - (delete-region start end) - (insert decoded)))) + (let* ((orig (buffer-substring start end)) + charsets) + (save-restriction + (narrow-to-region start end) + (mm-decode-coding-region (point-min) (point-max) coding-system) + (setq charsets (find-charset-region (point-min) (point-max))) + (when (or (memq 'eight-bit-control charsets) + (memq 'eight-bit-graphic charsets)) + (delete-region (point-min) (point-max)) + (insert orig) + (mm-decode-coding-region (point-min) (point-max) 'undecided))))) (defun mm-decode-string (string charset) "Decode STRING with CHARSET."