From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Piet van Oostrum Newsgroups: gmane.emacs.help Subject: Re: Customizing coding priority Date: Fri, 19 Jan 2007 15:04:25 +0100 Organization: Dept of Computer Science, Utrecht University, The Netherlands Message-ID: References: <17837.26945.133317.830421@kamaloka.dhatu> <17837.55152.906774.97483@relwi-sven.unibe.ch> <17838.42714.915656.255057@relwi-sven.unibe.ch> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 8bit X-Trace: sea.gmane.org 1169217647 10914 80.91.229.12 (19 Jan 2007 14:40:47 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 19 Jan 2007 14:40:47 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Jan 19 15:40:43 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1H7uur-0005tO-HD for geh-help-gnu-emacs@m.gmane.org; Fri, 19 Jan 2007 15:40:29 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1H7uur-0005ck-47 for geh-help-gnu-emacs@m.gmane.org; Fri, 19 Jan 2007 09:40:29 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!news2.google.com!news.germany.com!newsfeed.freenet.de!feeder.news-service.com!tudelft.nl!txtfeed1.tudelft.nl!ruu.nl!cs.uu.nl!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 86 Original-NNTP-Posting-Host: modena.cs.uu.nl Original-X-Trace: prometheus.cs.uu.nl 1169215466 21408 131.211.80.35 (19 Jan 2007 14:04:26 GMT) Original-X-Complaints-To: news@cs.uu.nl Original-NNTP-Posting-Date: Fri, 19 Jan 2007 14:04:26 +0000 (UTC) User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.92 (darwin) Cancel-Lock: sha1:6Rbu0EIb9ezEhSZjjabNnVm96ds= Original-Xref: shelby.stanford.edu gnu.emacs.help:144859 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: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:40463 Archived-At: >>>>> Sven Bretfeld (SB) wrote: >SB> I have inserted >SB> (require 'ucs-tables) >SB> (unify-8859-on-encoding-mode 1) >SB> in my .emacs file. But it didn't solve the problem. Maybe there is a >SB> mistake or a shortcoming in the vm-pakage. The standard VM just doesn't have the code to encode messages with characters from mixed charsets properly. If it can't find a single charset in the message that encodes all characters it chooses iso-2022-jp which is what you see in your message. This is an encoding that switches between other encodings with escape sequences. But most people outside Japan will not be able to read it. There are two solutions for it AFAIK. One is a small piece of code I wrote when the Euro was introduces, because I experienced the same problems when using the ¤-sign in VM. You just put this in your .emacs file. I am quite sure it won't work with XEmacs (never tried) but with Emacs 22 it does work. It follows below. It presupposes that unify-on-encoding was set. The other possiblity is to download Robert Widhopf-Fenk's version of VM from http://www.robf.de/Hacking/elisp. It contains more robust code that also works on XEmacs. maybe you can load only vm-mime.el, but I am not sure if it works with all the other files. I am using his whole package without problems. ,---- | (defun vm-sort-coding-systems-predicate (a b) | (> (length (memq a vm-coding-system-priorities)) | (length (memq b vm-coding-system-priorities)))) | | (setq vm-coding-system-priorities | '(iso-latin-1 iso-latin-9 mule-utf-8 mac-roman) | ; '(iso-latin-1 iso-latin-9 windows-1252 mule-utf-8 mac-roman) | mm-coding-system-priorities vm-coding-system-priorities) | | ; The next line is for a noautoload vm.elc. Otherwise use "vm-mime". | ;(eval-after-load "vm" | ; The next line is for an autoload (default) vm.elc. Otherwise use "vm". | (eval-after-load "vm-mime" | '(defun vm-determine-proper-charset (beg end) | (save-excursion | (save-restriction | (narrow-to-region beg end) | (catch 'done | (goto-char (point-min)) | (if (or vm-xemacs-mule-p | (and vm-fsfemacs-mule-p enable-multibyte-characters)) | (let ((charsets (delq 'compound-text (find-coding-systems-region | (point-min) (point-max))))) | (cond ((equal charsets '(undecided)) | "us-ascii") | (t | (setq charsets | (sort charsets 'vm-sort-coding-systems-predicate)) | (while charsets | (let ((cs (coding-system-get (pop charsets) 'mime-charset))) | (if cs | (throw 'done (symbol-name cs)))))))) | (and (re-search-forward "[^\000-\177]" nil t) | (throw 'done (or vm-mime-8bit-composition-charset | "iso-8859-1"))) | (throw 'done vm-mime-7bit-composition-charset))))))) | | ; This is only necessary for incoming mail in utf-7 or from Windows | (require 'utf-7) | (eval-after-load "vm" | '(setq vm-mime-mule-charset-to-coding-alist | (cons (quote ("utf-7" utf-7)) | ;code below is to accept mail from those morons that send | ; latin1 or windows-1252 characters without a charset declaration | ; (or with charset=ascii) | (cons (quote ("us-ascii" windows-1252)) | (cons (quote ("iso-8859-1" windows-1252)) | vm-mime-mule-charset-to-coding-alist))))) `---- -- Piet van Oostrum URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4] Private email: piet@vanoostrum.org