How to encode mail subject in perl ?
Now I finally found something but it's still not working :
use MIME::Words qw/encode_mimewords/;
$recipientsubject = encode_mimewords('Votre fichier a bien été envoyé');
But the (bugged) result is :
Subject: Votre fichier a bien =?ISO-8859-1?Q?=E9t=E9?= =?ISO-8859-1?Q?envoy=E9?=
Which displays :
Votre fichier a bien étéenvoyé
(It eats some spaces)
Use Encode, it is a core module.
… will output either one of:
And decode with:
Which will print:
If you still have the same results, you should give more information on your Perl environment. The version is a good starter.
Another module that handles MIME encoding of non-ASCII strings is Email::MIME::RFC2047. For example
prints
Some benefits of Email::MIME::RFC2047 over Encode:
Disclosure: I am the author of the module.