[Catalyst] UTF-8 and mails

Jens Schwarz blacky6767 at gmx.de
Mon Jan 25 12:43:45 GMT 2010


first of all: I have read http://dev.catalystframework.org/wiki/tutorialsandhowtos/Using_Unicode (especially the "Tips for Troubleshooting Unicode in Perl Web Applications")
Nevertheless I have a strange UTF-8 problem that I need help with:

Concerning UTF-8 everything in my App seems to work correct - except my mail action (I use Mail::Sender::Easy) in my Root controller:

use Mail::Sender::Easy qw(email);
use utf8;
sub mail :Private {
$mail_return = email({
  'subject'    => (... something from the database ...),
  '_text_info' => {
    charset  => 'utf-8',
    encoding => 'quoted-printable',
  '_text'      => (... some text with literal UTF-8 characters NOT from the database ...),

This produces mails that have messed up UTF-8 characters although the charset is set in the mail header, and the clients (right now tested with Thunderbird 3 and Outlook 2003) are configured to treat incoming mails as utf-8 encoded text. Strange: If I switch to ISO8859-1 in Thunderbird, the mails look alright. Outlook however simply drops the UTF-8 characters, so that p.ex. the German sentence "Nachricht für Herrn Müller" results in "Nachricht fr Herrn Mller".
If I remove the "use utf8", the UTF-8 characters that do NOT come from the database look fine (in the example above: everything in '_text'), the ones from the database are messed up (in the example above: everything in 'subject'). Removing the "charset => 'utf-8'" flag of the mail subroutine results in fine mails if I set the charset to ISO8859-1 in the clients.

To summerize: I have UTF-8-tifized everything that I am aware of - i.e.:
- Editor where the source code is produced
- source code itself
- in the MySQL database every table is set-up with UTF-8 Unicode charset and utf8_general_ci collation.
- the webbrowsers
- the email clients
- Catalyst ("use utf8", "UTF8Columns")
- Template Toolkit ("View::TT => {ENCODING => 'UTF-8'} ")
- FormFu ("tt_args => {ENCODING => 'UTF-8'}")

Any hints on where the problem might be?

Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3.5 -
sicherer, schneller und einfacher! http://portal.gmx.net/de/go/atbrowser

More information about the Catalyst mailing list