From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/65566 Path: news.gmane.org!not-for-mail From: Reiner Steib Newsgroups: gmane.emacs.devel,gmane.emacs.gnus.general Subject: imap.el: international/utf-7.el vs. gnus/utf7.el (was: 23.0.50; utf7-decode failed with non latin-1 charactor) Date: Tue, 06 Nov 2007 20:53:08 +0100 Message-ID: References: <87k5p1ho29.wl%topia@clovery.jp> <472B1AD5.3090006@gnu.org> Reply-To: Reiner Steib NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1194378918 15013 80.91.229.12 (6 Nov 2007 19:55:18 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 6 Nov 2007 19:55:18 +0000 (UTC) Cc: topia@clovery.jp, Jason Rumney To: Kenichi Handa , , Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Nov 06 20:55:20 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IpUW1-0002ev-5c for ged-emacs-devel@m.gmane.org; Tue, 06 Nov 2007 20:55:13 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IpUVq-0004wm-84 for ged-emacs-devel@m.gmane.org; Tue, 06 Nov 2007 14:55:02 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IpUVB-00049b-9S for emacs-devel@gnu.org; Tue, 06 Nov 2007 14:54:21 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IpUVA-00048m-PN for emacs-devel@gnu.org; Tue, 06 Nov 2007 14:54:20 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IpUVA-00048b-FG for emacs-devel@gnu.org; Tue, 06 Nov 2007 14:54:20 -0500 Original-Received: from mail.uni-ulm.de ([134.60.1.11]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1IpUV5-0001Xu-Lj; Tue, 06 Nov 2007 14:54:16 -0500 Original-Received: from bridgekeeper.physik.uni-ulm.de (bridgekeeper.physik.uni-ulm.de [134.60.41.37]) by mail.uni-ulm.de (8.14.1/8.14.1) with ESMTP id lA6Js5BH001086; Tue, 6 Nov 2007 20:54:06 +0100 (MET) Original-Received: from localhost (bridgekeeper.physik.uni-ulm.de [134.60.41.37]) by bridgekeeper.physik.uni-ulm.de (Postfix) with ESMTP id 4D30A12D54; Tue, 6 Nov 2007 20:54:05 +0100 (CET) X-Face: :6KQZ[nyoS_edmB.%gw-=)BYth^|2+Y+^cu%I$FSx!&>-'om>3H7A|M&n(V7fIo3P.; yo.b yq4$p; ZaBtkv)\}biaiBQe"mD}iib1AA@99-fZ7i*bLhNRVC&0Wkxg9)SH?oWc@{ Mail-Followup-To: Kenichi Handa , , , Jason Rumney , topia@clovery.jp In-Reply-To: (Kenichi Handa's message of "Mon, 05 Nov 2007 16:02:20 +0900") User-Agent: Gnus/5.110007 (No Gnus v0.7) Emacs/22.1.50 (gnu/linux) X-DCC-INFN-TO-Metrics: poseidon 1233; Body=5 Fuz1=5 Fuz2=5 X-Virus-Scanned: by amavisd-new X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:82674 gmane.emacs.gnus.general:65566 Archived-At: On Mon, Nov 05 2007, Kenichi Handa wrote: > Jason Rumney writes: >> Probably lisp/international/utf-7.el should be fixed, and the Gnus one >> dropped. Please keep in mind the we want to keep the Gnus versions in Emacs/trunk (Gnus 5.13) and Gnus/trunk (aka No Gnus) in sync. We want to keep No Gnus compatible with Emacs 21+ (and XEmacs 21.4+). So we need to add some compatibility code. > I think the right thing is to uncomment all codes for > utf-7-map in utf-7.el, and modify gnus to use normal > encode/decode-coding-region/string with utf-7-imap. > > I've just committed the former change. AFAIKS, `utf-7-encode' also accepts that FROM is a string, but it's not documented. Can we rely on this? Could you document it, please? > Could someone do the latter change? A grep through Gnus' sources suggests that it only uses the functions `utf7-encode' and `utf7-decode' in `imap.el'. How about the following patch to gnus/utf7.el (untested)? Could you suggest a better test instead of `(<= 23 emacs-major-version)'? Instead of -OLD and -NEW we should use more suitable names or include the defuns directly. --8<---------------cut here---------------start------------->8--- --- utf7.el 04 Aug 2007 20:36:34 +0200 1.12 +++ utf7.el 06 Nov 2007 20:42:08 +0100 @@ -207,7 +207,7 @@ (mm-decode-coding-region (point-min) (point-max) 'iso-8859-1) (mm-enable-multibyte)) -(defun utf7-encode (string &optional for-imap) +(defun utf7-encode-OLD (string &optional for-imap) "Encode UTF-7 STRING. Use IMAP modification if FOR-IMAP is non-nil." (let ((default-enable-multibyte-characters t)) (with-temp-buffer @@ -215,7 +215,7 @@ (utf7-encode-internal for-imap) (buffer-string)))) -(defun utf7-decode (string &optional for-imap) +(defun utf7-decode-OLD (string &optional for-imap) "Decode UTF-7 STRING. Use IMAP modification if FOR-IMAP is non-nil." (let ((default-enable-multibyte-characters nil)) (with-temp-buffer @@ -224,6 +224,31 @@ (mm-enable-multibyte) (buffer-string)))) +(defun utf7-encode-NEW (string &optional for-imap) + (with-temp-buffer + ;; (utf-7-encode FROM TO IMAP) + ;; + ;; `utf-7-encode' also accepts that FROM is a string, but it's not + ;; documented. + (utf-7-encode string nil for-imap) + (buffer-string))) + +(defun utf7-decode-NEW (string &optional for-imap) + (with-temp-buffer + (insert string) + (goto-char (point-min)) + ;; (utf-7-decode LEN IMAP) + (utf-7-decode (buffer-size) for-imap) + (buffer-string))) + +(if (and (require 'utf-7 nil t) ;; Additional test for XEmacs? + (<= 23 emacs-major-version)) ;; A feature test would be better + (progn + (defalias 'utf7-encode 'utf7-encode-NEW) + (defalias 'utf7-decode 'utf7-decode-NEW)) + (defalias 'utf7-encode 'utf7-encode-OLD) + (defalias 'utf7-decode 'utf7-decode-OLD)) + (provide 'utf7) ;;; arch-tag: 96078b55-85c7-4161-aed2-932c24b282c7 --8<---------------cut here---------------end--------------->8--- Bye, Reiner. -- ,,, (o o) ---ooO-(_)-Ooo--- | PGP key available | http://rsteib.home.pages.de/