Page 1 sur 1

Encodage des caractères accentués en entités HTML

MessagePublié: 17 Jan 2011, 18:10
par Imaxine
Suite à un problème décelé sur la recherche des textes de la description des produits, nous avons fait un correctif sur la version v1.4.9 Fr mise au téléchargement.

Lire ce sujet.

Re: Encodage des caractères accentués en entités HTML

MessagePublié: 08 Nov 2011, 15:31
par Imaxine
Nous avons vu plusieurs sujets concernant l'encodage des caractères accentués.

Pour palier à ce problème et afin d'éviter la modification de multiple fichiers, on peut simplement modifier la class "mail" situé dans ce répertoire system/library/mail.php.

Chercher ces lignes :
Code: Tout sélectionner
   public function setTo($to) {
      $this->to = $to;
   }

   public function setFrom($from) {
      $this->from = $from;
   }

   public function setSender($sender) {
      $this->sender = html_entity_decode($sender, ENT_QUOTES, 'UTF-8');
   }

   public function setSubject($subject) {
      $this->subject = html_entity_decode($subject, ENT_QUOTES, 'UTF-8');
   }

   public function setText($text) {
      $this->text = $text;
   }

   public function setHtml($html) {
      $this->html = $html;
   }

   public function addAttachment($file, $filename = '') {
      if (!$filename) {
         $filename = basename($file);
      }

      $this->attachments[] = array(
         'filename' => $filename,
         'file'     => $file
      );
   }
Et les remplacer par celles-ci :
Code: Tout sélectionner
   public function setTo($to) {
      $this->to = html_entity_decode($to, ENT_NOQUOTES, 'UTF-8');
   }

   public function setFrom($from) {
      $this->from = html_entity_decode($from, ENT_NOQUOTES, 'UTF-8');
   }

   public function setSender($sender) {
      $this->sender = html_entity_decode($sender, ENT_NOQUOTES, 'UTF-8');
   }

   public function setSubject($subject) {
      $this->subject = html_entity_decode($subject, ENT_NOQUOTES, 'UTF-8');
   }

   public function setText($text) {
      $this->text = html_entity_decode($text, ENT_NOQUOTES, 'UTF-8');
   }

   public function setHtml($html) {
      $this->html = html_entity_decode($html, ENT_NOQUOTES, 'UTF-8');
   }

   public function addAttachment($file, $filename = '') {
      if (!$filename) {
         $filename = basename($file);
      }

      $this->attachments[] = array(
         'filename' => html_entity_decode($filename, ENT_NOQUOTES, 'UTF-8'),
         'file'     => html_entity_decode($file, ENT_NOQUOTES, 'UTF-8')
      );
   }