From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.help Subject: Re: changing encoding of buffer Date: Tue, 29 May 2007 22:52:11 +0300 Message-ID: References: <7rnqi4-vn5.ln1@ID-306968.user.individual.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: sea.gmane.org 1180468353 22604 80.91.229.12 (29 May 2007 19:52:33 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 29 May 2007 19:52:33 +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 21:52:32 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 1Ht7k7-0001fi-Pf for geh-help-gnu-emacs@m.gmane.org; Tue, 29 May 2007 21:52:32 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ht7k7-0005ys-DH for geh-help-gnu-emacs@m.gmane.org; Tue, 29 May 2007 15:52:31 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ht7jr-0005yn-DL for help-gnu-emacs@gnu.org; Tue, 29 May 2007 15:52:15 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Ht7jq-0005yb-58 for help-gnu-emacs@gnu.org; Tue, 29 May 2007 15:52:14 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ht7jq-0005yU-11 for help-gnu-emacs@gnu.org; Tue, 29 May 2007 15:52:14 -0400 Original-Received: from nitzan.inter.net.il ([213.8.233.22]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Ht7jp-0005Qg-F9 for help-gnu-emacs@gnu.org; Tue, 29 May 2007 15:52:13 -0400 Original-Received: from HOME-C4E4A596F7 (IGLD-84-228-244-17.inter.net.il [84.228.244.17]) by nitzan.inter.net.il (MOS 3.7.3a-GA) with ESMTP id GVP12024 (AUTH halo1); Tue, 29 May 2007 22:52:16 +0300 (IDT) In-reply-to: (message from M G Berberich on Tue, 29 May 2007 14:39:20 +0200) X-detected-kernel: FreeBSD 4.7-5.2 (or MacOS X 10.2-10.4) (2) 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:44535 Archived-At: > From: M G Berberich > Date: Tue, 29 May 2007 14:39:20 +0200 > > > 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. And your newsreader cannot be told that, when the encoding is not stated, to assume windows-1252, as your fix-ms-posting does? (Btw, did you use that newsreader to post your article? If so, it also lies about the encoding: it claimed the message was in Latin-9 (iso-8859-15), when in fact it was in UTF-8.) > 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 … In my experience, when the encoding is not stated, or stated as Latin-1, it is windows-1252. I have yet to see a koi8-r encoded message that doesn't say it, but I guess anything could happen. > > I see no need to call `recode': Emacs can do that itself. > > Fine, how can this be done? Use encode-coding-region to encode the region in windows-1252, then use decode-coding-region to decode it back as UTF-8. That's it!