Subject: Re: [sup-talk] [PATCH] detect and set charset on text/* attachments

From: William Morgan <[email-masked]>
Date: Tue, 03 Nov 2009 09:16:32 -0800

Reformatted excerpts from Helge Titlestad's message of 2009-10-19:
> I got some feedback from non-suppers that my utf-8 text attachments
> were messed up. When I checked they (the MIME headers) lacked any info
> on charset, which I believe should be set for text/*.

After reviewing the RFCs, yeah, I think you're basically right. The
charset parameter is not required to be set for text/* mime types, but
if it's unset, the part is assumed to be us-ascii.

> Here's a patch that uses the chardet gem to (try to) detect the
> appropriate charset and sets it in the Content-Type header.

Although I don't relish adding yet another gem dependency, I think this
is the right approach.

It looks like the chardet gem is unmaintained. But someone decided to
make their own special version called rchardet which is completely
equivalent version but *is* maintained. (What is it with these goddamn
ruby people.)

I suggest we use rchardet instead of chardet. Would you like to change
the patch? If not, I will get to it at some point.

> Please tell me if I should use some different way of sending
> patches... This git flow is a bit new to me. (=

Nope, this is perfect. Thanks!
-- 
William <[email-masked]>
_______________________________________________
sup-talk mailing list
[email-masked]
http://rubyforge.org/mailman/listinfo/sup-talk

---

From: Helge Titlestad <[email-masked]>
Date: Tue, 03 Nov 2009 20:23:28 +0100

Excerpts from William Morgan's message of Tue Nov 03 18:16:32 +0100 2009:
> equivalent version but *is* maintained. 
> 

Here you go!

One thing I noticed when trying it out: It will set charset 'ascii' for ascii
text, which is allowed by the RFC but "US-ASCII" is preferred. I think I prefer
to not create a special case in the code to change it to US-ASCII or remove the
charset for ascii text, but other people might disagree.
-- 
alge
_______________________________________________
sup-talk mailing list
[email-masked]
http://rubyforge.org/mailman/listinfo/sup-talk

---

From: Helge Titlestad <[email-masked]>
Date: Mon, 19 Oct 2009 16:07:26 +0200

I got some feedback from non-suppers that my utf-8 text attachments were
messed up. When I checked they (the MIME headers) lacked any info on charset,
which I believe should be set for text/*.

Here's a patch that uses the chardet gem to (try to) detect the appropriate charset
and sets it in the Content-Type header.

Can't guarantee its robustness - have only tried on a couple of text files and
one non-text file.

Please tell me if I should use some different way of sending patches... This git
flow is a bit new to me. (=
-- 
alge
_______________________________________________
sup-talk mailing list
[email-masked]
http://rubyforge.org/mailman/listinfo/sup-talk