This Emacs Lisp function is supposed to give me RFC 2047 by using
external command:

(defun rcd-mailutils-flt2047 (string &optional encoding q-or-b)
  (let*  ((encoding (or encoding "utf-8"))
          (q-or-b (or "Q" q-or-b))
          (command (format "mailutils flt2047 -c %s -E%s \"%s\"" encoding 
q-or-b string))
          (result (string-trim (shell-command-to-string command))))
    result))

And I get this:

(rcd-mailutils-flt2047 "Č <[email protected]>")
"=?utf-8?Q?=C4=8C_<[email protected]>?="

And then mail complains that email address is not valid.

If I use the built in Emacs function then I get different result:

(rfc2047-encode-string "Č <[email protected]>")
"=?utf-8?Q?=C4=8C?= <[email protected]>"

Another question is if `mailutils flt2047' really needs to encode
something what need not be encoded, as this below is also not encoding it:

(rfc2047-encode-string "ABC <[email protected]>")
"ABC <[email protected]>"

while this is encoding:

(rfc2047-encode-string "ABČ <[email protected]>")
"=?utf-8?Q?AB=C4=8C?= <[email protected]>"

while this is also encoding which is probably not necessary and probably 
incorrect.

(rcd-mailutils-flt2047 "ABC <[email protected]>")
"=?utf-8?Q?ABC_<[email protected]>?="

Maybe the function from mailutils asks me to parse and separate
name from the email address. It is just hypothetical question on
how it should be.

-- 
Thanks,
Jean Louis
⎔ λ 🄯 𝍄 𝌡 𝌚

Reply via email to