From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Jym Dyer Newsgroups: gmane.emacs.help Subject: Re: fixing M$ character codes Supersedes: Date: 04 Jul 2004 07:08:50 -0700 Organization: Brood X Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: <2ko3egF4flbgU1@uni-berlin.de> NNTP-Posting-Host: deer.gmane.org X-Trace: sea.gmane.org 1088950700 7348 80.91.224.253 (4 Jul 2004 14:18:20 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 4 Jul 2004 14:18:20 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Jul 04 16:18:13 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1Bh7or-0003wj-00 for ; Sun, 04 Jul 2004 16:18:13 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1Bh7qm-0003UK-EM for geh-help-gnu-emacs@m.gmane.org; Sun, 04 Jul 2004 10:20:12 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!fu-berlin.de!uni-berlin.de!not-for-mail Original-Newsgroups: gnu.emacs.help,comp.emacs,alt.religion.emacs Original-Followup-To: gnu.emacs.help Original-Lines: 77 Original-X-Trace: news.uni-berlin.de a/8K8oRraH6ZYgMunyNGQQjMPxNUHiz7H5fucQFfHRbiuuGIM= Original-Xref: shelby.stanford.edu gnu.emacs.help:124119 comp.emacs:85306 alt.religion.emacs:8553 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:19450 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:19450 =v= I think ideally the code would parse headers to figure out whether the brain damaged quotes are supposed to be ISO-Latin, Windows-1252, UTF-8, or whatever. But for now I just use a sledgehammer and convert any and all needlessly-8bit characters to their 7bit equivalents. =v= The code I use is below. I suppose someday I ought to make them more comprehensive, but for now I just add what I need along the way. (Warning: this converts all know quotes and dashes to ASCII equivalents, but also convert centered dots to asterisks, which isn't exactly an equivalent.) <_Jym_> (defun jym.de8 () "Turn 8bit characters into 7bit equivalents." (interactive) (mapcar (function (lambda (old_and_new) (save-excursion (apply 'query-replace old_and_new)))) '(("" "-") ("" "'") ("" "''") ("" "``") ("" "*") ("" "...") ("" "--") ("" "`") ("" "`") ("" "``") ; = 0x93 ("" "''") ; = 0x94 ("" "*") ("" "-") ; = 0x96 ("" "--") ; = 0x97 ("" "`") ("" "'") ("" "``") ("" "''") ("" "") ))) ;mapcar; ;defun jym.de8; (defun jym.de8qp () "Turn quoted printable 8bit into 7bit equivalents." (interactive) (mapcar (function (lambda (old_and_new) (save-excursion (apply 'query-replace old_and_new)))) '(("=\n" "") ;("=E2=80=94" "--") ("=E2=80=99" "'") ; UTF-8 ("=E2=80=9C" "``") ; UTF-8 ("=E2=80=9D" "''") ; UTF-8 ("=0D\n" "\n") ; = \r\n ("=20\n" "\n") ("=2E" ".") ("=3F" "?") ("=46" "F") ("=5B" "[") ("=5D" "]") ("=8B" "--") ("=8C" "`") ("=91" "`") ("=92" "'") ("=93" "``") ; = 0223 ("=94" "''") ("=96" "-") ; = 0226 ("=97" "--") ; = 0227 ("=A0" " ") ("=A5" "'") ("=AD" "--") ("=AE" "\"") ("=B2" "``") ("=B3" "''") ("=B9" "'")) )) ;mapcar; ;defun jym.de8qp;