Etant donné que la syntaxe de la fonction pour envoyer un courriel en php est

bool mail ( string $to , string $subject , string $message 
[, string $additional_headers 
  [, string $additional_parameters ]
] 
)

et la solution pour les headers http est de la forme

header("content-type: text/plain; charset=utf-8")

La suggestion suivante me paraît sensée:

Conseil de php.net pour les caractères à accent, etc.

Zane @ MLI 08-Sep-2010 10:17 Italian users cursing against “È” and other uppercase-accented-vowels (“vocali maiuscole accentate””) in subjects! While the lowercase ones (“è”, “é” and so on) work as expected, qmail doesn't handle the uppercase ones.

To fix it, the only way I found was this:

<?php
 
function mail_utf8($to, $subject = '(No subject)', $message = '', $header = '') {
  $header_ = 'MIME-Version: 1.0' . "\r\n" . 'Content-type: text/plain; charset=UTF-8' . "\r\n";
  mail($to, '=?UTF-8?B?'.base64_encode($subject).'?=', $message, $header_ . $header);
}

?>

It should apply to other languages too.

 
projet_dch/charset.txt · Dernière modification: 2011/06/27 17:07 par suitable
 
Sauf mention contraire, le contenu de ce wiki est placé sous la licence suivante :CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki