[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: changing encoding of buffer
From: |
M G Berberich |
Subject: |
Re: changing encoding of buffer |
Date: |
Tue, 29 May 2007 14:39:20 +0200 |
User-agent: |
slrn/0.9.8.1pl1 (Debian) |
On Mon, 28 May 2007 23:21:34 +0300, Eli Zaretskii <eliz@gnu.org> wrote:
>> From: M G Berberich <berberic@forwiss.uni-passau.de>
>> 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