Subject: Re: bug#7517: 24.0.50; repeated crash under Mac OS X

From: Stefan Monnier <[email-masked]>
Date: Fri, 31 Dec 2010 18:07:22 -0500

>>> Emacs should never use unibyte strings for buffer names.
>> I don't think we make any effort to prevent this from happening.
>> And I'm not completely sure that it would be worth the trouble either:
>> I suspect that wherever a unibyte buffer-name would cause problem
>> (mode-line, window title, younameit), some other unibyte string could
>> appear from elsewhere just as well, so enforcing multibyte buffer-names
>> wouldn't close the vulnerabilities.

> If we don't at least ENCODE_UTF_8 should do the right thing.  Is the coding
> for these kind of strings known?  If not and we don't enforce encoding in
> basic interfaces, we must deal with all existing encodings?

I'd tend to agree.  ENCODE_UTF_8 is used for things where we *really*
want the output to be proper utf-8, so any char outside of utf-8
(e.g. an eight-bit char) should result in something else than a raw byte
in the output.  This is contrary to what we do for utf-8 files, where we
output eight-bit chars as raw bytes (because any sequence of bytes
that's not valid utf-8 in the input leads to such eight-bit chars in
the buffer, so outputting them as raw bytes is used to preserve the
file unchanged when saved).

        Stefan