bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: edited file is deleted when the file cannot be saved because of its


From: Kenichi Handa
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)
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)

In article <address@hidden>, Fery <address@hidden> 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
address@hidden




reply via email to

[Prev in Thread] Current Thread [Next in Thread]