[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#13505: Bug#696026: emacs24: file corruption on saving
From: |
Vincent Lefevre |
Subject: |
bug#13505: Bug#696026: emacs24: file corruption on saving |
Date: |
Sun, 20 Jan 2013 23:10:08 +0100 |
User-agent: |
Mutt/1.5.21-6290-vl-r57386 (2013-01-17) |
On 2013-01-20 23:40:14 +0200, Eli Zaretskii wrote:
> > Date: Sun, 20 Jan 2013 22:25:08 +0100
> > From: Vincent Lefevre <vincent@vinc17.net>
> > Cc: Rob Browning <rlb@defaultvalue.org>, Kenichi Handa <handa@gnu.org>,
> > 13505@debbugs.gnu.org, 696026-forwarded@bugs.debian.org,
> > 696026@bugs.debian.org
> >
> > On 2013-01-20 18:49:38 +0200, Eli Zaretskii wrote:
> > > Personally, I don't think there's a bug here. It's a cockpit error.
> >
> > Perhaps it isn't a bug at save time. But then, selecting a lossy
> > encoding by default when visiting the file is the bug (and really
> > a regression), particularly if this isn't clearly told to the user.
>
> The encoding isn't lossy.
You said:
| The original encoded form of the characters as found on disk at
| visit time _cannot_ be recovered by saving with raw-text, because
| that encoded form is lost without a trace when the file is _visited_
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| and decoded into the internal representation.
This is what lossy is.
On the opposite, the utf-8 encoding doesn't seem to be lossy: Emacs
seems to handle files with invalid UTF-8 sequences without any loss.
So, this encoding is safe, even if Emacs wrongly guess the encoding.
> In any case, I don't really understand your proposal. Suppose the
> file was indeed encoded in in-is13194-devanagari, would you argue then
> that selecting it would be incorrect or undesirable behavior?
If Emacs modifies the contents when saving the file, it would be
incorrect.
> > Actually this is related, since the lossy encoding becomes a real
> > problem only at save time (and for copy-paste I assume, though the
> > file doesn't get overwritten by that).
>
> It is only a problem when you try to save or otherwise output it
> (e.g., send in an email).
>
> But what you should do then is "C-x RET r raw-text RET", and recover.
> That is the only way to avoid corruption in files that use
> inconsistent encoding.
But Emacs should clearly tell the user what to do after C-x C-s and
clearly say when there can be data loss. Currently it says:
"These default coding systems were tried to encode text
in the buffer `file1':
(in-is13194-devanagari-unix (2 . 2376) (3 . 4194176) (4 . 4194201)
(5 . 2341) (6 . 2314) (12 . 2364)) (utf-8-unix (3 . 4194176) (4 .
4194201))
However, each of them encountered characters it couldn't encode:
in-is13194-devanagari-unix cannot encode these: [...]
utf-8-unix cannot encode these: [...]"
This shouldn't be regarded as a problem by the user, because if Emacs
could read and interpret the file (and such characters have not been
added by the user), it should be able to save it.
Then Emacs says: "Select one of the safe coding systems listed below
[...]", but doesn't say that something has already been lost. So, the
words "safe coding systems" are really misleading.
--
Vincent Lefèvre <vincent@vinc17.net> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
- bug#13505: Bug#696026: emacs24: file corruption on saving, Rob Browning, 2013/01/19
- bug#13505: Bug#696026: emacs24: file corruption on saving, Eli Zaretskii, 2013/01/20
- bug#13505: Bug#696026: emacs24: file corruption on saving, Rob Browning, 2013/01/20
- bug#13505: Bug#696026: emacs24: file corruption on saving, Glenn Morris, 2013/01/20
- bug#13505: Bug#696026: emacs24: file corruption on saving, Vincent Lefevre, 2013/01/20
- bug#13505: Bug#696026: emacs24: file corruption on saving, Eli Zaretskii, 2013/01/20
- bug#13505: Bug#696026: emacs24: file corruption on saving, Vincent Lefevre, 2013/01/20
- bug#13505: Bug#696026: emacs24: file corruption on saving, Eli Zaretskii, 2013/01/21
- bug#13505: Bug#696026: emacs24: file corruption on saving, Vincent Lefevre, 2013/01/21
- bug#13505: Bug#696026: emacs24: file corruption on saving, Eli Zaretskii, 2013/01/22
bug#13505: Bug#696026: emacs24: file corruption on saving, Andreas Schwab, 2013/01/20