From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: M G Berberich Newsgroups: gmane.emacs.help Subject: Re: changing encoding of buffer Date: Tue, 29 May 2007 14:39:20 +0200 Organization: Comp.Center (RUS), U of Stuttgart, FRG Message-ID: References: <7rnqi4-vn5.ln1@ID-306968.user.individual.net> Reply-To: berberic@fmi.uni-passau.de 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 1180460147 22245 80.91.229.12 (29 May 2007 17:35:47 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 29 May 2007 17:35:47 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue May 29 19:35: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 1Ht5bi-0002Qw-Jk for geh-help-gnu-emacs@m.gmane.org; Tue, 29 May 2007 19:35:42 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ht5bh-0006BN-KC for geh-help-gnu-emacs@m.gmane.org; Tue, 29 May 2007 13:35:42 -0400 Original-Path: shelby.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!newsfeed.freenet.de!news.tu-darmstadt.de!news.belwue.de!news.uni-stuttgart.de!manwe.forwiss.uni-passau.de!news Original-Newsgroups: gnu.emacs.help Original-Lines: 43 Original-X-Trace: infosun2.rus.uni-stuttgart.de 1180442821 16918 132.231.20.23 (29 May 2007 12:47:01 GMT) Original-X-Complaints-To: news@news.uni-stuttgart.de Original-NNTP-Posting-Date: Tue, 29 May 2007 12:47:01 +0000 (UTC) User-Agent: slrn/0.9.8.1pl1 (Debian) Original-Xref: shelby.stanford.edu gnu.emacs.help:148941 X-Mailman-Approved-At: Tue, 29 May 2007 13:34:36 -0400 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:44533 Archived-At: On Mon, 28 May 2007 23:21:34 +0300, Eli Zaretskii wrote: >> From: M G Berberich >> Date: Mon, 28 May 2007 12:34:47 +0200 >> >> When I reply, my newsreader appends my UTF-8 signature and starts >> emacs. > > If you append UTF-8 text unconditionally, I think you are guilty no > less than MS: no one said that arbitrary encoded text can be freely > mixed with UTF-8. Suppose those unnamed "MS-products" did announce > they produce text in windows-1252, how would that help you avoid the > problem? Then my newsreader would convert the text from windows-1252 to UTF-8 (which is my locale environment) before calling emacs and all would work fine. The problem is that the encoding is not declared, so the newsreader does not know that it is windows-1252 and not koi8-r or EBCDIC or latin-2 or … >> I wrote this function to solve the problem: >> >> (defun fix-ms-posting () >> "Fixes newsposting that are garbled up by Microsoft-Software" >> (interactive) >> (let ((coding-system-for-write 'raw-text) >> (coding-system-for-read 'utf-8) >> (end (progn (end-of-buffer) (search-backward "\n-- \n")))) >> (revert-buffer-with-coding-system 'utf-8) >> (set-buffer-file-coding-system 'utf-8) >> (shell-command-on-region (point-min) end >> "recode windows-1252..utf-8" nil t))) > > I see no need to call `recode': Emacs can do that itself. Fine, how can this be done? MfG bmg -- Artikel 3 und 12a des Grundgesetzes kurz | M G Berberich zusammengefaßt: Männer und Frauen sind | berberic@fmi.uni-passau.de gleichberechtigt, ausgenommen Männer, die | müssen zur Bundeswehr. | http://www.uni-passau.de/~berberic