unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* edited file is deleted when the file cannot be saved because of its coding system
@ 2003-06-02 13:44 Fery
  2003-06-05  0:18 ` Kenichi Handa
  0 siblings, 1 reply; 4+ messages in thread
From: Fery @ 2003-06-02 13:44 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 2196 bytes --]

In GNU Emacs 21.3.2 (i386-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2003-04-24 on raven, modified by Debian
configured using `configure  i386-linux --prefix=/usr
--sharedstatedir=/var/lib --libexecdir=/usr/lib --localstatedir=/var/lib
--infodir=/usr/share/info --mandir=/usr/share/man --with-pop=yes
--with-x=yes --with-x-toolkit=athena --without-gif'
Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: C
  locale-coding-system: nil
  default-enable-multibyte-characters: t

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:

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). 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).

(Anyway, it is interesting why emacs does not recognize my 
txt as utf-8 text, and interprets it as iso-latin-1-unix...)

Attached I send the file gzipped which was loaded into emacs.

emacs started with: 'emacs test'

Recent input:
a DEL C-x C-s C-g C-x C-c n n o RET ESC x r e p o TAB 
r TAB RET

(If I would say 'yes' instead of 'no' at quit, emacs would generate a
'#test#' file where some bytes are preceded by \201 bytes.)

Recent messages:
Loading 50nowebm (source)...done
Loading 50w3 (source)...done
Loading 55doxymacs (source)...
Loading mule-util...done
Loading 55doxymacs (source)...done
For information about the GNU Project and its goals, type C-h C-p.
Loading view...done
byte-code: Quit
Making completion list...
Loading emacsbug...done

Regards:
Circum

[-- Attachment #2: test.gz --]
[-- Type: application/x-gzip, Size: 99 bytes --]

[-- Attachment #3: Type: text/plain, Size: 148 bytes --]

_______________________________________________
Bug-gnu-emacs mailing list
Bug-gnu-emacs@gnu.org
http://mail.gnu.org/mailman/listinfo/bug-gnu-emacs

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: edited file is deleted when the file cannot be saved because of its coding system
  2003-06-02 13:44 edited file is deleted when the file cannot be saved because of its coding system Fery
@ 2003-06-05  0:18 ` Kenichi Handa
  2003-06-06 11:34   ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Kenichi Handa @ 2003-06-05  0:18 UTC (permalink / raw)
  Cc: bug-gnu-emacs

In article <3EDB54B4.D1F6462C@innomed.hu>, Fery <engard.ferenc@innomed.hu> 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: edited file is deleted when the file cannot be saved because of its coding system
  2003-06-05  0:18 ` Kenichi Handa
@ 2003-06-06 11:34   ` Eli Zaretskii
  2003-06-06 12:31     ` Kenichi Handa
  0 siblings, 1 reply; 4+ messages in thread
From: Eli Zaretskii @ 2003-06-06 11:34 UTC (permalink / raw)
  Cc: engard.ferenc

> Date: Thu, 5 Jun 2003 09:18:21 +0900 (JST)
> From: Kenichi Handa <handa@m17n.org>
> 
> > 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.

Wasn't this a bug in some v21.x of Emacs that was fixed later?
Handa-san, did you try this in the CVS version of Emacs?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: edited file is deleted when the file cannot be saved because of its coding system
  2003-06-06 11:34   ` Eli Zaretskii
@ 2003-06-06 12:31     ` Kenichi Handa
  0 siblings, 0 replies; 4+ messages in thread
From: Kenichi Handa @ 2003-06-06 12:31 UTC (permalink / raw)
  Cc: engard.ferenc

In article <2427-Fri06Jun2003143434+0300-eliz@elta.co.il>, "Eli Zaretskii" <eliz@elta.co.il> writes:
>>  > 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.

> Wasn't this a bug in some v21.x of Emacs that was fixed
> later?  Handa-san, did you try this in the CVS version of
> Emacs?

Oops, from some point, the mails between me and Fery don't
include bug-gnu-emacs@gnu.org in CC:.

I'll attach the last mail I sent to him.  It seems that the
problem is already fixed in HEAD.

---
Ken'ichi HANDA
handa@m17n.org

Date: Fri, 6 Jun 2003 14:22:07 +0900 (JST)
From: Kenichi Handa <handa@m17n.org>
To: engard.ferenc@innomed.hu
CC: handa@m17n.org
In-reply-to: <3EDF26E1.44AB5C4D@innomed.hu> (message from Fery on Thu, 05 Jun	2003 13:17:53 +0200)
Subject: Re: edited file is deleted when the file cannot be saved because of its  coding system

In article <3EDF26E1.44AB5C4D@innomed.hu>, Fery <engard.ferenc@innomed.hu> writes:
> I have played a bit more with this problem, and noticed
> that it saves a backup with a ~ on the end, so I have the
> original file! Sorry, I have missed this. So, if I have
> 'test', after ^X^S I will have 'test~' (it is moved,
> timestamp etc. is retained), and after quitting '#test#'
> (with internal encoding) and 'test~' with the original
> content.

I confirmed that hahaviour with 21.3 and CVS RC branch.
And I found that this problem is now fixed in HEAD branch.
In HEAD, at the point of Emacs asking you a
coding system, 'test' is surely moved to 'test~', but when
you type C-g, 'test~' is moved back to 'test'.

>>  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).

> After all, emacs do not permit to save it, so from this
> point of view it is not a valid iso-latin-1 file for
> emacs. :-O

Sorry, what I wrote was wrong.  In 21.3 and RC, \225 is not
yet registered as a valid latin code, but has a bug in code
detection routine.  This bug is already fixed in the HEAD
branch.

---
Ken'ichi HANDA
handa@m17n.org

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-06-06 12:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-06-02 13:44 edited file is deleted when the file cannot be saved because of its coding system Fery
2003-06-05  0:18 ` Kenichi Handa
2003-06-06 11:34   ` Eli Zaretskii
2003-06-06 12:31     ` Kenichi Handa

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).