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: How to keep character encoding in text file... Date: Fri, 06 Mar 2009 12:51:17 +0200 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE X-Trace: ger.gmane.org 1236336715 2428 80.91.229.12 (6 Mar 2009 10:51:55 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 6 Mar 2009 10:51:55 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Mar 06 11:53:12 2009 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 1LfXg0-0000aX-3r for geh-help-gnu-emacs@m.gmane.org; Fri, 06 Mar 2009 11:53:12 +0100 Original-Received: from localhost ([127.0.0.1]:37398 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LfXee-0002sj-FS for geh-help-gnu-emacs@m.gmane.org; Fri, 06 Mar 2009 05:51:48 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LfXeB-0002se-1j for help-gnu-emacs@gnu.org; Fri, 06 Mar 2009 05:51:19 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LfXe9-0002sS-PI for help-gnu-emacs@gnu.org; Fri, 06 Mar 2009 05:51:18 -0500 Original-Received: from [199.232.76.173] (port=37208 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LfXe9-0002sP-JB for help-gnu-emacs@gnu.org; Fri, 06 Mar 2009 05:51:17 -0500 Original-Received: from mtaout1.012.net.il ([84.95.2.1]:58999) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LfXe9-00034e-2Y for help-gnu-emacs@gnu.org; Fri, 06 Mar 2009 05:51:17 -0500 Original-Received: from conversion-daemon.i-mtaout1.012.net.il by i-mtaout1.012.net.il (HyperSendmail v2007.08) id <0KG200E00ZIAED00@i-mtaout1.012.net.il> for help-gnu-emacs@gnu.org; Fri, 06 Mar 2009 12:51:57 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([84.229.248.57]) by i-mtaout1.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0KG200K9EZIJW9F0@i-mtaout1.012.net.il> for help-gnu-emacs@gnu.org; Fri, 06 Mar 2009 12:51:56 +0200 (IST) In-reply-to: X-012-Sender: halo1@inter.net.il X-detected-operating-system: by monty-python.gnu.org: Solaris 9.1 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:62669 Archived-At: > From: Marko Myllymaki > Date: Fri, 06 Mar 2009 09:39:56 +0200 >=20 > Eli Zaretskii wrote: > >> So... if I load UTF-8 encoded file, emacs always saves it that w= ay. If I=20 > >> open latin1-encoded file, it should keep it in the original enco= ding. > >=20 > > Yes, that's how it's supposed to work, if you don't let any > > non-Latin-1 characters creep in. >=20 > Okay, that might be the problem... because my system defaults to UT= F-8,=20 > I guess that there is some keyboard input encoding in emacs which u= ses=20 > UTF-8. No, that shouldn't in itself be a problem, as long as the characters your keyboard input inserts are encodable in Latin-1. When Emacs receives keyboard input, it first decodes all the characters into its internal representation. After such decoding, it no longer matters how the characters were transmitted to Emacs, only if they have a valid encoding in Latin-1. In other words, keyboard input encoding has no direct relation to whe= n Emacs decides that the original file's encoding cannot be used to sav= e the modified buffer. > Therefore if I enter "baz" in latin1 buffer, everything is okay, bu= t=20 > "foobar =E5=E4=F6" has some UTF-8 and it then forces buffer encodin= g to UTF-8... All 3 characters you cited above are encodable in Latin-1, so this cannot be the problem. You need to find out (e.g., by using the=20 "C-u C-x =3D" command on suspect characters) which one of the charact= ers you typed cannot be encoded in Latin-1. Which Emacs version is that, by the way?