unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Kenichi Handa <handa@m17n.org>
Cc: bug-gnu-emacs@gnu.org
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)	[thread overview]
Message-ID: <200306050018.JAA02272@etlken.m17n.org> (raw)
In-Reply-To: <3EDB54B4.D1F6462C@innomed.hu> (message from Fery on Mon, 02 Jun 2003 15:44:20 +0200)

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

  reply	other threads:[~2003-06-05  0:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2003-06-06 11:34   ` Eli Zaretskii
2003-06-06 12:31     ` Kenichi Handa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200306050018.JAA02272@etlken.m17n.org \
    --to=handa@m17n.org \
    --cc=bug-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).