unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Mysterious use of string-as-multibyte
@ 2018-01-11 16:04 Stefan Monnier
  2018-01-15 14:36 ` handa
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2018-01-11 16:04 UTC (permalink / raw)
  To: Kenichi Handa; +Cc: emacs-devel

Hi,

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


        Stefan


commit 83af570eae8668c9308050c1bb56b7bd10c0e4e7
Author: Kenichi Handa <handa@m17n.org>
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"))



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-01-17 12:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-11 16:04 Mysterious use of string-as-multibyte Stefan Monnier
2018-01-15 14:36 ` handa
2018-01-15 21:39   ` Stefan Monnier
2018-01-17 12:32     ` handa

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).