dhoss / catalyst-view-email

how does this not exist
3 stars 8 forks source link

Catalyst::View::Email::Template encoding woes #10

Open abraxxa opened 8 years ago

abraxxa commented 8 years ago

Text::Xslate encodes it's output by default to utf-8. As Catalyst handles encoding itself I've disabled that using encode_body => 0. Currently I'm facing wrong encoded emails although I've set content_type => 'text/html' and charset => 'utf-8' in my View::Email::Template config. While looking through the code I found https://metacpan.org/source/DHOSS/Catalyst-View-Email-0.36/lib/Catalyst/View/Email/Template.pm#L229 which looks like a subtle bug to me as the encoding config option doesn't hold the e.g. utf-8 but the charset does. Encoding here is for example 'quoted-printable' and shouldn't influence the used Email::MIME api (body vs. body_str). When not set encoding seems to default to 7bit which is also the default according to the Wikipedia article on MIME.

I might be missing something here so please clarify the topic and I'm happy to provide a doc patch explaining the useful values for content_type, charset and encoding.

Setting encoding => 'quoted-printable' did fix me emails, but I'm not sure because of the other used Email::MIME api or if utf-8 isn't possible using something but 'quoted-printable' MIME encoding.

pkarman commented 8 years ago

@abraxxa some code (or better, test) showing the problem would be lovely. PR even better. I'm not sure I follow the narrative bits.

abraxxa commented 8 years ago

I've cloned the repo and tried to come up with a failing test but it seems the current ones don't check the generated emails but the body from Email::Sender::Transport::Test which isn't enough. I haven't found a test that checks the encoded (as in 7bit, quoted-printable, etc.) email in Email::Sender's tests either. Do you have a suggestion how to do that?

karpet commented 8 years ago

Sorry to let this fall out the other side of my inbox, @abraxxa

I think both @dhoss and I are not doing Perl or Catalyst these days and not finding the tuits to pay attention to this module. Seems like there is some encoding interest in #12 as well -- perhaps new maintainers could step forward? Maybe ask on the Catalyst email lists?

dhoss commented 8 years ago

Seconded. I don't even have an up to date build of perl on any of my machines, so that alone deters me from picking issues up. I'm happy to hand this over to whoever wants to take it if someone asks on the mailing list or something.