From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chong Yidong Newsgroups: gmane.emacs.devel Subject: Re: [yazicivo@ttnet.net.tr: Locale Dependent Downcasing in smtpmail] Date: Tue, 03 Apr 2007 12:30:37 -0400 Message-ID: <87ircdh13m.fsf@stupidchicken.com> References: <87wt0uhee5.fsf@ttnet.net.tr> <873b3hssyt.fsf@mocca.josefsson.org> <87y7l9608n.fsf@ttnet.net.tr> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1175617881 31271 80.91.229.12 (3 Apr 2007 16:31:21 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 3 Apr 2007 16:31:21 +0000 (UTC) Cc: simon@josefsson.org, Volkan YAZICI , handa@m17n.org, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Apr 03 18:31:15 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 1HYluZ-0003UU-3K for ged-emacs-devel@m.gmane.org; Tue, 03 Apr 2007 18:31:11 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HYlxi-0006TF-OW for ged-emacs-devel@m.gmane.org; Tue, 03 Apr 2007 12:34:26 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HYlxe-0006Sx-Mw for emacs-devel@gnu.org; Tue, 03 Apr 2007 12:34:22 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HYlxd-0006Si-FW for emacs-devel@gnu.org; Tue, 03 Apr 2007 12:34:21 -0400 Original-Received: from south-station-annex.mit.edu ([18.72.1.2]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1HYluS-0005Lo-Ng; Tue, 03 Apr 2007 12:31:05 -0400 Original-Received: from central-city-carrier-station.mit.edu (CENTRAL-CITY-CARRIER-STATION.MIT.EDU [18.7.7.72]) by south-station-annex.mit.edu (8.13.6/8.9.2) with ESMTP id l33GV2VW006048; Tue, 3 Apr 2007 12:31:02 -0400 (EDT) Original-Received: from outgoing-legacy.mit.edu (OUTGOING-LEGACY.MIT.EDU [18.7.22.104]) by central-city-carrier-station.mit.edu (8.13.6/8.9.2) with ESMTP id l33GUds5027446; Tue, 3 Apr 2007 12:30:45 -0400 (EDT) Original-Received: from localhost ([18.19.7.211]) ) by outgoing-legacy.mit.edu (8.13.6/8.12.4) with ESMTP id l33GUbES003553; Tue, 3 Apr 2007 12:30:38 -0400 (EDT) Original-Received: from cyd by localhost with local (Exim 3.36 #1 (Debian)) id 1HYlu1-0001Xc-00; Tue, 03 Apr 2007 12:30:37 -0400 In-Reply-To: (Eli Zaretskii's message of "Tue\, 03 Apr 2007 18\:29\:42 +0300") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.96 (gnu/linux) X-Scanned-By: MIMEDefang 2.42 X-Spam-Score: 0 X-detected-kernel: Solaris 9.1 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:69004 Archived-At: Eli Zaretskii writes: >> nndoc.el:511: (intern (downcase (mail-header-strip encoding)))))) >> nndoc.el:905: subtype (downcase (match-string 2 content-type)) >> rfc2047.el:674: (concat "=3D?" (downcase (symbol-name mime-charset)) >>=20 >> Failing Cases: >> (downcase "ISO-8859-1") =3D=3D> =C4=B1so-8859-1 >> (downcase "text/plain") =3D=3D> text-pla=C4=B1n > > Perhaps we should have something like downcase-ascii for such > situations. Yeah. How about the following approach? At the beginning of characters.el, save the standard case table (which AFAICT hasn't been modified at that point), as a variable ascii-case-table. Then downcase-ascii can use it. *** emacs/lisp/international/characters.el.~1.65.~ 2007-03-05 02:00:16.0000= 00000 -0500 --- emacs/lisp/international/characters.el 2007-04-03 12:18:07.000000000 -0= 400 *************** *** 43,48 **** --- 43,54 ---- =20=20 ;;; Predefined categories. =20=20 + ;; Save ASCII case table. +=20 + (require 'case-table) + (defvar ascii-case-table (copy-case-table (standard-case-table)) + "Case table for the ASCII character set.") +=20 ;; For each character set. =20=20 (define-category ?a "ASCII graphic characters 32-126 (ISO646 IRV:1983[4/0= ])") *** emacs/lisp/subr.el.~1.549.~ 2007-03-19 14:37:19.000000000 -0400 --- emacs/lisp/subr.el 2007-04-03 12:26:04.000000000 -0400 *************** *** 2804,2809 **** --- 2804,2819 ---- ;; Reconstruct a string from the pieces. (setq matches (cons (substring string start l) matches)) ; leftover (apply #'concat (nreverse matches))))) +=20 + (defun downcase-ascii (string) + "Convert ASCII argument to lower case and return that. + The argument may be a character or string. The result has the same type. + The argument object is not altered--the value is a copy." + (let ((old-case-table (current-case-table))) + (unwind-protect + (progn (set-case-table ascii-case-table) + (downcase string)) + (set-case-table old-case-table)))) ;;;; invisibility specs =20=20