> 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. _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel