Bonjour,
J'ai un problème d'encodage de caractère et je pense que ça vient du fait que j'utilise ajax. En effet quand j'appelle la page normalement, les accents s'affichent correctement.
En gros j'ai 3 listes déroulante liées entre elles. Quand un accent apparait il est apparait comme ça: �.
Quelqu'un pourrait il m'aider ?
Mon code PHP est:
C'est donc $element['SousDiscipline']['nom'] qui s'encode mal. J'ai essayé utf8_encode mais ça ne change rien.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8 <?php header('Content-Type:text/html; charset=utf-8'); $this->layout = 'ajax'; $getSousDiscipline = $this->SousDiscipline->find('all', array('conditions' => array('SousDiscipline.discipline_id' => $id))); foreach($getSousDiscipline as $key => $element) { echo '<option value="'.$element['SousDiscipline']['id'].'">'.$element['SousDiscipline']['nom'].'</option>'; } ?>
Merci
Partager