[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: decode-coding-string gone awry?
From: |
Stefan Monnier |
Subject: |
Re: decode-coding-string gone awry? |
Date: |
Tue, 15 Feb 2005 11:17:10 -0500 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
> Is it reasonable to operate with decode-coding-string on a multibyte
> string? If that is nonsense, maybe we should make it get an error,
> to help people debug such problems.
I think it would indeed make sense to signal errors when decoding
a multibyte string or when encoding a unibyte string.
> If there are some few cases where decode-coding-string makes sense on
> a multibyte string, maybe we can make it get an error except in those
> few cases.
The problem I suspect is that it's pretty common for ASCII-only strings to
be arbitrarily marked unibyte or multibyte depending on the circumstance.
So we would have to check for the case where the string is ASCII-only before
signalling an error.
I'm actually running right now with an Emacs that does signal such errors.
I've changed the notion of "multibyte/unibyte" string by saying:
- [same as now] if size_byte < 0, it's UNIBYTE.
- [same as now] if size_byte > size, it's MULTIBYTE.
- [changed] if size_byte == size, it's neither/both (ASCII-only).
Then I've changed several parts of the C code to try and set size_byte==size
whenever possible (instead of marking the string as unibyte).
Stefan
PS: As of now, the only place where Emacs has signalled a bad
encoding/decoding with the proposed error is in Gnus, though I haven't
checked any further whether this error really is a bug in Gnus.
- decode-coding-string gone awry?, David Kastrup, 2005/02/12
- Re: decode-coding-string gone awry?, Kenichi Handa, 2005/02/13
- Re: decode-coding-string gone awry?, David Kastrup, 2005/02/13
- Re: decode-coding-string gone awry?, Richard Stallman, 2005/02/15
- Re: decode-coding-string gone awry?, David Kastrup, 2005/02/15
- Re: decode-coding-string gone awry?,
Stefan Monnier <=
- Re: decode-coding-string gone awry?, Richard Stallman, 2005/02/17
- Re: decode-coding-string gone awry?, Kenichi Handa, 2005/02/17
- Re: decode-coding-string gone awry?, Stefan Monnier, 2005/02/17
- Re: decode-coding-string gone awry?, Kenichi Handa, 2005/02/18
- Re: decode-coding-string gone awry?, Stefan Monnier, 2005/02/18
- Re: decode-coding-string gone awry?, Richard Stallman, 2005/02/19
- Re: decode-coding-string gone awry?, Richard Stallman, 2005/02/18
- Re: decode-coding-string gone awry?, Richard Stallman, 2005/02/19
- Re: decode-coding-string gone awry?, Kenichi Handa, 2005/02/20
- Re: decode-coding-string gone awry?, Richard Stallman, 2005/02/22