From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Kenichi Handa Newsgroups: gmane.emacs.bugs Subject: Re: edited file is deleted when the file cannot be saved because of its coding system Date: Thu, 5 Jun 2003 09:18:21 +0900 (JST) Sender: bug-gnu-emacs-bounces+gnu-bug-gnu-emacs=m.gmane.org@gnu.org Message-ID: <200306050018.JAA02272@etlken.m17n.org> References: <3EDB54B4.D1F6462C@innomed.hu> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 (generated by SEMI 1.14.3 - "Ushinoya") Content-Type: text/plain; charset=US-ASCII X-Trace: main.gmane.org 1054773368 9914 80.91.224.249 (5 Jun 2003 00:36:08 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Thu, 5 Jun 2003 00:36:08 +0000 (UTC) Cc: bug-gnu-emacs@gnu.org Original-X-From: bug-gnu-emacs-bounces+gnu-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jun 05 02:36:04 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19Nijc-0002Zf-00 for ; Thu, 05 Jun 2003 02:36:04 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.20) id 19NibC-0003jJ-5j for gnu-bug-gnu-emacs@m.gmane.org; Wed, 04 Jun 2003 20:27:22 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.20) id 19NiU8-0001jq-DK for bug-gnu-emacs@gnu.org; Wed, 04 Jun 2003 20:20:04 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.20) id 19NiTT-0001Wi-BI for bug-gnu-emacs@gnu.org; Wed, 04 Jun 2003 20:19:24 -0400 Original-Received: from tsukuba.m17n.org ([192.47.44.130]) by monty-python.gnu.org with esmtp (Exim 4.20) id 19NiSa-0001GU-Oj for bug-gnu-emacs@gnu.org; Wed, 04 Jun 2003 20:18:29 -0400 Original-Received: from fs.m17n.org (fs.m17n.org [192.47.44.2])h550IMu02069; Thu, 5 Jun 2003 09:18:22 +0900 (JST) (envelope-from handa@m17n.org) Original-Received: from etlken.m17n.org (etlken.m17n.org [192.47.44.125]) h550IL923178; Thu, 5 Jun 2003 09:18:21 +0900 (JST) Original-Received: (from handa@localhost) by etlken.m17n.org (8.8.8+Sun/3.7W-2001040620) id JAA02272; Thu, 5 Jun 2003 09:18:21 +0900 (JST) Original-To: engard.ferenc@innomed.hu In-reply-to: <3EDB54B4.D1F6462C@innomed.hu> (message from Fery on Mon, 02 Jun 2003 15:44:20 +0200) User-Agent: SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/21.2.92 (sparc-sun-solaris2.6) MULE/5.0 (SAKAKI) X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Bug reports for GNU Emacs, the Swiss army knife of text editors List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: bug-gnu-emacs-bounces+gnu-bug-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.bugs:5236 X-Report-Spam: http://spam.gmane.org/gmane.emacs.bugs:5236 In article <3EDB54B4.D1F6462C@innomed.hu>, Fery writes: > I have loaded a utf-8 encoded text into the buffer, > modified it, then tried to save it. Now emacs said the > following: > --------------- > These default coding systems were tried: > iso-latin-1-unix > However, none of them safely encodes the target text. > Select one of the following safe coding systems: > utf-8 mule-utf-16-le mule-utf-16-be raw-text emacs-mule > no-conversion > --------------- > After that, I have entered C-g to escape from this function. > At this point, my original file has gone (and, there is no > recovery file yet). I can't reproduce it. The original file still exists after I type C-g at the above point. Could you try it again with emacs started by "-q --no-site-file"? Are there any possibility that you have write-file-functions or write-contents-functions? > Anyway, if I quit without saving, the > #filename# file's content isn't the same as the original (it > contains \201 bytes before non-ascii chars). When Emacs writes a backup/autosave file, it writes out the internal encoding as is for speed. But recover-file should be able to handle it correctly. > (Anyway, it is interesting why emacs does not recognize my > txt as utf-8 text, and interprets it as iso-latin-1-unix...) In C locale, iso-latin-1 has higher priority than utf-8, and all bytes in your file are regarded as valid for iso-latin-1. (The byte \225 (#x95) is also registered as valid latin code in latin-extra-code-table). If you start emacs in some UTF-8 locale, the file should be detected as utf-8. Ex: % LANG=en_US.UTF-8 emacs test --- Ken'ichi HANDA handa@m17n.org