unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@IRO.UMontreal.CA>
To: Kenichi Handa <handa@m17n.org>
Cc: emacs-devel@gnu.org
Subject: Mysterious use of string-as-multibyte
Date: Thu, 11 Jan 2018 11:04:39 -0500	[thread overview]
Message-ID: <jwv373c5qqh.fsf-monnier+emacs@gnu.org> (raw)

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"))



             reply	other threads:[~2018-01-11 16:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-11 16:04 Stefan Monnier [this message]
2018-01-15 14:36 ` Mysterious use of string-as-multibyte handa
2018-01-15 21:39   ` Stefan Monnier
2018-01-17 12:32     ` handa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwv373c5qqh.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=handa@m17n.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).