unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* utf-7-imap doesn't shift back to US-ASCII
@ 2008-02-28  9:03 Daiki Ueno
  2008-02-28 19:44 ` Stefan Monnier
  0 siblings, 1 reply; 2+ messages in thread
From: Daiki Ueno @ 2008-02-28  9:03 UTC (permalink / raw)
  To: emacs-devel

Hello,

When I tried to access Gmail's outgoing message folder via IMAP with
Gnus, I encountered a problem.  The folder name is localized for
Japanese and encoded in UTF-7 + the RFC2060 modification, but Emacs
doesn't seem to encode correctly in that encoding.

RFC2060 5.1 says:

   "&" is used to shift to modified BASE64 and "-" to shift back to US-
   ASCII.  All names start in US-ASCII, and MUST end in US-ASCII (that
   is, a name that ends with a Unicode 16-bit octet MUST end with a "-
   ").

      For example, here is a mailbox name which mixes English, Japanese,
      and Chinese text: ~peter/mail/&ZeVnLIqe-/&U,BTFw-

(encode-coding-string
 (decode-coding-string "~peter/mail/&ZeVnLIqe-/&U,BTFw-" 'utf-7-imap)
 'utf-7-imap)

=> "~peter/mail/&ZeVnLIqe-/&U,BTFw"

Here is a patch to fix this.

Index: lisp/international/utf-7.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/international/utf-7.el,v
retrieving revision 1.11
diff -w -c -r1.11 utf-7.el
*** lisp/international/utf-7.el	1 Feb 2008 16:01:18 -0000	1.11
--- lisp/international/utf-7.el	28 Feb 2008 08:58:00 -0000
***************
*** 110,116 ****
  	      ;; consistent with iconv, at least regarding `='.
  	      (skip-chars-forward "^= \t\n")
  	      (delete-region (point) (point-max))))
! 	  (unless (eobp)
  	    (insert ?-)))))
      nil))
  
--- 110,116 ----
  	      ;; consistent with iconv, at least regarding `='.
  	      (skip-chars-forward "^= \t\n")
  	      (delete-region (point) (point-max))))
! 	  (if (or imap (not (eobp)))
  	      (insert ?-)))))
      nil))
  
Regards,
-- 
Daiki Ueno




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

* Re: utf-7-imap doesn't shift back to US-ASCII
  2008-02-28  9:03 utf-7-imap doesn't shift back to US-ASCII Daiki Ueno
@ 2008-02-28 19:44 ` Stefan Monnier
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier @ 2008-02-28 19:44 UTC (permalink / raw)
  To: Daiki Ueno; +Cc: emacs-devel

> When I tried to access Gmail's outgoing message folder via IMAP with
> Gnus, I encountered a problem.  The folder name is localized for
> Japanese and encoded in UTF-7 + the RFC2060 modification, but Emacs
> doesn't seem to encode correctly in that encoding.

Thanks, installed,


        Stefan




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

end of thread, other threads:[~2008-02-28 19:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-28  9:03 utf-7-imap doesn't shift back to US-ASCII Daiki Ueno
2008-02-28 19:44 ` Stefan Monnier

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