Reputation: 277
I have a problem with special characters in my symfony program, I usually save my pages with UTF-8 without BOM (I use notepad++) for exemple this page is displayed correcly :
je suis lé
<h1>Ajouter un acteur</h1>
{% if message %}
<p>{{ message }}</p>
{% endif %}
<form action="" method="post" {{ form_enctype(form) }}>
{{ form_widget(form) }}
<input type="submit" />
</form>
<p><a href="{{ path('myapp_acteur_lister') }}">Retour à la liste des acteurs</a></p>
this line je suis lé
is displayed well
but when I execute a controller function which return a string , this string is not displayed well :
here is the function :
public function editerAction($id = null)
{
$message='';
$em = $this->container->get('doctrine')->getEntityManager();
if (isset($id))
{
// modification d'un acteur existant : on recherche ses données
$acteur = $em->find('MyAppFilmothequeBundle:Acteur', $id);
if (!$acteur)
{
$message='Aucun acteur trouvé';
}
}
else
{
// ajout d'un nouvel acteur
$acteur = new Acteur();
}
$form = $this->container->get('form.factory')->create(new ActeurForm(), $acteur);
$request = $this->container->get('request');
if ($request->getMethod() == 'POST')
{
$form->bindRequest($request);
if ($form->isValid())
{
$em->persist($acteur);
$em->flush();
if (isset($id))
{
$message='Acteur modifié avec succès !';
}
else
{
$message='Acteur ajouté avec succès !';
}
}
}
return $this->container->get('templating')->renderResponse(
'MyAppFilmothequeBundle:Acteur:editer.html.twig',
array(
'form' => $form->createView(),
'message' => $message,
));
}
here is the capture of the page :
how can I achieve this?
Upvotes: 0
Views: 915