[Catalyst] UTF-8 and mails

Alexander Hartmaier alexander.hartmaier at t-systems.at
Mon Jan 25 12:52:45 GMT 2010


Before testing end-to-end figure out if the chars from your database are
*really* utf-8.
I forgot to set an env var for the oracle client library to tell it I
want unicode which broke my app under fcgid.

If you're using DBIx::Class to access your database see
http://www.perlmonks.org/?node_id=736234.

--
Best regards, Alex


Am Montag, den 25.01.2010, 13:43 +0100 schrieb Jens Schwarz:
> Hi,
>
> 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:
>
> <code>
> (...)
> 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 ...),
>   (...)
> });
> (...)
> }
> </code>
>
> 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?
> Thanks
>
> Jens


*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
T-Systems Austria GesmbH   Rennweg 97-99, 1030 Wien
Handelsgericht Wien, FN 79340b
*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
Notice: This e-mail contains information that is confidential and may be privileged.
If you are not the intended recipient, please notify the sender and then
delete this e-mail immediately.
*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*



More information about the Catalyst mailing list