From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.user/4267 Path: news.gmane.org!not-for-mail From: Aidan Kehoe Newsgroups: gmane.emacs.gnus.user Subject: Gnus MIME charset advice, with XEmacs Date: Fri, 26 Nov 2004 18:42:16 +0000 Message-ID: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1138670231 22558 80.91.229.2 (31 Jan 2006 01:17:11 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 31 Jan 2006 01:17:11 +0000 (UTC) Original-X-From: nobody Tue Jan 17 17:33:30 2006 Original-Path: quimby.gnus.org!newsfeed1.e.nsc.no!news.tele.dk!news.tele.dk!small.news.tele.dk!fu-berlin.de!uni-berlin.de!not-for-mail Original-Newsgroups: comp.emacs.xemacs,gnu.emacs.gnus Original-Followup-To: comp.emacs.xemacs Original-X-Trace: news.uni-berlin.de gts0t13Et4oU9GZ4+mzPbQ5uHQi6Z/K9/R9Dy/KXe4naC4ZYga User-Agent: Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.4 (Rational FORTRAN, linux) Cancel-Lock: sha1:eP4ngFzpcTP9yn+l0L4RMz5QlSI= Original-Xref: bridgekeeper.physik.uni-ulm.de gnus-emacs-gnus:4408 Original-Lines: 51 X-Gnus-Article-Number: 4408 Tue Jan 17 17:33:30 2006 Xref: news.gmane.org gmane.emacs.gnus.user:4267 Archived-At: Hi! I'm not in East Asia, yet I occasionally use Gnus to post messages to Usenet which venture beyond ISO-8859-1, or, even, ISO-8859-15. The below advice makes this possible, preferring UTF-8 to the XEmacs default of ISO-2022-JP and/or multipart encodings. (Nothing but Emacs understands postings that have been multipart-encoded for different character sets, to my knowledge.) It's not that full-featured, and should be written to take advantage of Stephen Turnbull's Latin Unity, and to take notice of mm-coding-system-priorities. But it does what I want for the moment, and I think it may be useful for other people wanting to do similar things. If you're using the stable version of XEmacs, you'll need to load Mule-UCS to have Gnus find the UTF-8 coding system. I have; (unless (or (coding-system-p (find-coding-system 'utf-8)) (null (locate-library "un-define"))) (require 'un-define) (require 'unidata)) in my ~/.xemacs/init.el, which has the nice side affect of also working on, and not interfering with, 21.5 and its built-in Unicode support. Bye, - Aidan ;; Try to get GNUS to do the sane thing when sending messages that can't be ;; encoded in Latin 1. (defadvice mm-find-mime-charset-region (after do-sane-mime-charset-select activate) "Look at the contents of a message, and if they fit in ASCII, return nil. If they fit in ISO-8859-1, return `iso-8859-1', otherwise return `utf-8'. Should revise this to use Latin Unity, and a configurable list of preferred MIME character sets. " (let ((charsets (delq 'ascii (charsets-in-region (ad-get-arg 0) (ad-get-arg 1))))) (setq ad-return-value (cond ((null charsets) nil) ((and (eq 1 (length charsets)) (eq 'latin-iso8859-1 (car charsets))) '(iso-8859-1)) (t '(utf-8)))))) -- "As democracy is perfected, the office of president represents, more and more closely, the inner soul of the people. On some great and glorious day the plain folks of the land will reach their heart's desire at last and the White House will be adorned by a downright moron." -- H.L. Mencken