emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Mysterious use of string-as-multibyte


From: Stefan Monnier
Subject: Mysterious use of string-as-multibyte
Date: Thu, 11 Jan 2018 11:04:39 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Hi,

Do you remember why you added the call to string-as-multibyte in the
patch below?


        Stefan


commit 83af570eae8668c9308050c1bb56b7bd10c0e4e7
Author: Kenichi Handa <address@hidden>
Date:   Tue May 25 11:12:17 1999 +0000

    (smtpmail-send-it): Bind smtpmail-code-conv-from properly.
    (smtpmail-send-data-1): If DATA is a multibyte string, encode it
    by smtpmail-code-conv-from.

diff --git a/lisp/mail/smtpmail.el b/lisp/mail/smtpmail.el
index 4778ded17b..192235a242 100644
--- a/lisp/mail/smtpmail.el
+++ b/lisp/mail/smtpmail.el
@@ -122,7 +122,11 @@ smtpmail-send-it
        (tembuf (generate-new-buffer " smtpmail temp"))
        (case-fold-search nil)
        delimline
-       (mailbuf (current-buffer)))
+       (mailbuf (current-buffer))
+       (smtpmail-code-conv-from
+        (if enable-multibyte-characters
+            (let ((sendmail-coding-system smtpmail-code-conv-from))
+              (select-message-coding-system)))))
     (unwind-protect
        (save-excursion
          (set-buffer tembuf)
@@ -564,8 +568,10 @@ smtpmail-send-command
 (defun smtpmail-send-data-1 (process data)
   (goto-char (point-max))
 
-  (when smtpmail-code-conv-from
-    (setq data (encode-coding-string data *internal* smtpmail-code-conv-from)))
+  (if (and (multibyte-string-p data)
+           smtpmail-code-conv-from)
+      (setq data (string-as-multibyte
+                  (encode-coding-string data smtpmail-code-conv-from))))
        
   (if smtpmail-debug-info
       (insert data "\r\n"))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]