all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Piet van Oostrum <piet@cs.uu.nl>
Subject: Re: Customizing coding priority
Date: Fri, 19 Jan 2007 15:04:25 +0100	[thread overview]
Message-ID: <m2bqkv2jva.fsf@ordesa.lan> (raw)
In-Reply-To: mailman.3276.1169158455.2155.help-gnu-emacs@gnu.org

>>>>> Sven Bretfeld <sven.bretfeld@relwi.unibe.ch> (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 <piet@cs.uu.nl>
URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4]
Private email: piet@vanoostrum.org

  parent reply	other threads:[~2007-01-19 14:04 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-17  0:09 Customizing coding priority Sven Bretfeld
2007-01-17  0:26 ` Peter Dyballa
2007-01-17  4:16 ` Eli Zaretskii
2007-01-17  7:59   ` Sven Bretfeld
2007-01-17 18:35     ` Eli Zaretskii
2007-01-17 22:44       ` Sven Bretfeld
2007-01-18  4:20         ` Eli Zaretskii
2007-01-18  4:58           ` Tom Rauchenwald
2007-01-18 10:02             ` Peter Dyballa
2007-01-18 16:12           ` Sven Bretfeld
2007-01-18 16:32             ` Peter Dyballa
2007-01-18 18:27               ` Reiner Steib
2007-01-18 21:36             ` Eli Zaretskii
2007-01-18 17:31           ` Reiner Steib
2007-01-18 18:15             ` Peter Dyballa
2007-01-18 18:46               ` Reiner Steib
2007-01-18 22:14                 ` Sven Bretfeld
2007-01-18 22:20                   ` Sven Bretfeld
2007-01-19 10:23                     ` Eli Zaretskii
2007-01-19  0:24                 ` Peter Dyballa
2007-01-19  9:37                   ` Reiner Steib
2007-01-19 10:40                   ` Eli Zaretskii
     [not found]                 ` <mailman.3276.1169158455.2155.help-gnu-emacs@gnu.org>
2007-01-19 14:04                   ` Piet van Oostrum [this message]
2007-01-19 17:10                     ` [SOLVED] " Sven Bretfeld
2007-01-19 22:45                       ` Lennart Borgman (gmail)
2007-01-17 20:38     ` Sven Bretfeld

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2bqkv2jva.fsf@ordesa.lan \
    --to=piet@cs.uu.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.