all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Lars Magne Ingebrigtsen <larsi@gnus.org>
Cc: monnier@IRO.UMontreal.CA, emacs-devel@gnu.org
Subject: Re: master 8f03888: * lisp/gnus/gnus-art.el: Fix up compiler warnings.
Date: Fri, 16 Jan 2015 10:54:31 +0200	[thread overview]
Message-ID: <83d26f2ji0.fsf@gnu.org> (raw)
In-Reply-To: <m3twzr8nwq.fsf@gnus.org>

> From: Lars Magne Ingebrigtsen <larsi@gnus.org>
> Date: Fri, 16 Jan 2015 03:22:45 +0100
> Cc: emacs-devel@gnu.org
> 
> (defun utf7-fragment-encode (start end &optional for-imap)
>   "Encode text from START to END in buffer as UTF-7 escape fragment.
> Use IMAP modification if FOR-IMAP is non-nil."
>   (save-restriction
>     (narrow-to-region start end)
>     (funcall (utf7-get-u16char-converter 'to-utf-16))
>     (mm-with-unibyte-current-buffer
>       (base64-encode-region start (point-max)))
>     (goto-char start)
>     (let ((pm (point-max)))
>       (when for-imap
> 	(while (search-forward "/" nil t)
> 	  (replace-match ",")))
>       (skip-chars-forward "^= \t\n" pm)
>       (delete-region (point) pm))))
> 
> So we have some non-ASCII text in the buffer, and er, we convert that to
> utf-16?  And then we convert the utf-16 represented as utf-8 byte
> sequences to base64?  Uhm.

The UTF-16 encoded text is represented as series of 8-bit bytes, which
are themselves represented as UTF-8 sequences outside of the Unicode
range of characters.  There's no special problem here, since Emacs is
quite capable of holding raw bytes in a multibyte buffer.

> Yeah, OK, `mm-with-unibyte-current-buffer' is probably not helping with
> understanding that function any.  :-)  So if somebody would be so kind
> to rewrite these functions, that would be nice.

I would suggest using the optional DESTINATION argument of
encode-coding-region, pointing it at a separate scratch buffer that
was made unibyte when it was created.  Thgen base64-encode-region
could be run on that buffer without the mm-with-unibyte-current-buffer
stuff.



  reply	other threads:[~2015-01-16  8:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20141218182000.19577.72337@vcs.savannah.gnu.org>
     [not found] ` <E1Y1fgA-00056N-7o@vcs.savannah.gnu.org>
2015-01-15 21:58   ` master 8f03888: * lisp/gnus/gnus-art.el: Fix up compiler warnings Lars Magne Ingebrigtsen
2015-01-15 22:44     ` Stefan Monnier
2015-01-15 23:12       ` Lars Magne Ingebrigtsen
2015-01-16  2:07         ` Stefan Monnier
2015-01-16  2:22           ` Lars Magne Ingebrigtsen
2015-01-16  8:54             ` Eli Zaretskii [this message]
2015-01-16 16:09               ` Lars Magne Ingebrigtsen
2015-01-16  8:40         ` Eli Zaretskii

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

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

  git send-email \
    --in-reply-to=83d26f2ji0.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=larsi@gnus.org \
    --cc=monnier@IRO.UMontreal.CA \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.