Topic: Set two different charset in the language pack

I have an issue... some languages are best covered with UTF-8 (like french, and most of europeans languages) but a lot of mailers (including Eudora, and I believe Outlook) don't like utf-8 emails at all (yes it's a shame).

Would it be difficult to add a charset declaration in the email templates files so that the translator can revert back to something else (in that case Latin9 for example) ?

Re: Set two different charset in the language pack

Not really. I've thought about it before, but have dismissed it because it will require updates to all language packs.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: Set two different charset in the language pack

I just thought of another issue... I believe some emails messages transmit the content of a post for example. So inside a mail, you have the talking in Latin1 (for example) and the post-content in unicode. Not good.

So, I will code it myself. Can you confirm that pun_mail() in email.php is the only way of sending an email for PunBB ? If I edit mail($to, $subject, $message, $headers); with a utf8_decode for example, it should work ?

Re: Set two different charset in the language pack

Yes, all e-mail is sent through pun_mail().

"Programming is like sex: one mistake and you have to support it for the rest of your life."

5 (edited by Jérémie 2005-04-01 13:26)

Re: Set two different charset in the language pack

Yep it worked, thanks.

In case someone want to do the same (use unicode on the forum, but latin on the email) it's quite simple. In /include/email.php change

$headers = 'From: '.$from.$eol.'Date: '.date('r').$eol.'MIME-Version: 1.0'.$eol.'Content-transfer-encoding: 8bit'.$eol.'Content-type: text/plain; charset='.$lang_common['lang_encoding'].$eol.'X-Mailer: PunBB Mailer';

to

$headers = 'From: '.$from.$eol.'Date: '.date('r').$eol.'MIME-Version: 1.0'.$eol.'Content-transfer-encoding: 8bit'.$eol.'Content-type: text/plain; charset=iso-8859-1'.$eol.'X-Mailer: PunBB Mailer';

and add, before

    if ($pun_config['o_smtp_host'] != '')
        smtp_mail($to, $subject, $message, $headers);
    else
        mail($to, $subject, $message, $headers);

the lines :

    $subject = utf8_decode($subject);
    $message = utf8_decode($message);
    $headers = utf8_decode($headers);

Re: Set two different charset in the language pack

I have only a problem with special caracter like æ and ? in the title subject with Mozilla in UTF-8.
All the other is ok, é à ê è Ç etc etc.

Sorry for my french english.
GT4 Club driver France & Forum - Lingerie.

7 (edited by Jérémie 2005-04-01 13:35)

Re: Set two different charset in the language pack

Thunderbird can read unicode emails, as TheBat! and some others. In fact, all email software should do it, utf-8 is pretty old and utf-8 email were a standard recomandation since 1999 iirc. But, unfortunately, Eudora and Outlook (at least) two big clients, can't read it at all.

8 (edited by Romuald 2005-04-01 14:04)

Re: Set two different charset in the language pack

I did your change and got :

Mail sent from PunBB wrote:

Subject : test é à æ?

Ææ?????®@~#®¡~^#{®?
opirh gferonzugj _ç(ut

And it's give :

On Mozilla wrote:

Subject : test é à æ?

Ææ?????®@~#®¡~^#{®?
opirh gferonzugj _ç(ut

? ? ? didn't work.

Sorry for my french english.
GT4 Club driver France & Forum - Lingerie.

Re: Set two different charset in the language pack

Of course, it's Latin1.If I wanted to use utf-8 in the first place, it's because its the *only* charset that cover all french language (and a lot of others).

Latin1 doesn't cover it all, Latin9 is a little better but still not perfect. And I don't know of a PHP function to translate into Latin9 (and I don't want to do it by hand, it's a small trick until Rickard go full utf-8 and does it himself, or whatever).