Subject: Re: bug#13808: Gnus gratuiously messes with the encoding of attachments

From: David Kastrup <[email-masked]>
Date: Fri, 31 Jan 2014 07:46:13 +0100

Lars Ingebrigtsen <[email-masked]> writes:

> Lars Ingebrigtsen <[email-masked]> writes:
>
>> I just tried sending out a utf-8 file, and Message decided it was 8859,
>> so it's totally garbled:
>>
>> --=-=-=
>> Content-Type: text/plain; charset=iso-8859-1
>> Content-Disposition: inline; filename=foo.txt
>> Content-Transfer-Encoding: base64
>>
>> QmzDpWLDpnINCg==
>> --=-=-=
>>
>> Yuck.
>>
>> Hm...  what's determining the charset in the file, anyway?
>
> It's calling `find-coding-systems-region', which just returns
> `(undecided)'.  Er.  So how is this supposed to work, really?
>
> How Emacs detects coding systems remains a mystery to me...  Anybody
> have any insights here?

Texts don't have a coding system.  What Emacs can detect is what coding
systems an _external_ representation of a multibyte buffer or string
might take.  find-coding-systems-region just returns a list of proposals
all of which will equally work for representing the buffer.  "undecided"
means that there are no non-ASCII characters and _anything_ will work.

If find-coding-systems-region is called on a base64 encoded region, that
will always be its verdict.  That's pretty much the point of base64.

-- 
David Kastrup